Obaida wrote:Thank you......488.... it give me at least 20 or more wA.... some one please help me..........please.........
You are printing an extra '\n' at the first line of the output..
PS. Remove you code after AC..
Moderator: Board moderators
Obaida wrote:Thank you......488.... it give me at least 20 or more wA.... some one please help me..........please.........
2\n
\n
3\n
2\n
1\n
22\n
333\n
22\n
1\n
\n
1\n
22\n
333\n
22\n
1\n
\n
3\n
2\n
1\n
22\n
333\n
22\n
1\n
\n
1\n
22\n
333\n
22\n
1\n
Obaida wrote:Now look at my output.... I thik thats good.... but still WA
Removed
#include <stdio.h>
int main ()
{
int i, j, k;
int caseNum;
int a, f;
char num[10][10] = {"", "1", "22", "333", "4444", "55555", "666666", "7777777", "88888888", "999999999"};
scanf ("%d", &caseNum);
for (i = 0; i < caseNum; i++)
{
scanf ("%d%d", &a, &f);
for (j = 0; j < f; j++)
{
for (k = 1; k <= a; k++)
{
printf ("%s\n", num[k]);
}
k = k - 2;
for (; k >= 1; k--)
{
printf ("%s\n", num[k]);
}
//if (i != caseNum - 1)
printf ("\n");
}
}
return 0;
}#include <iostream>
#include <string>
using namespace std;
int main(){
int tc;
cin >> tc;
string nums[9] = {"1","22","333","4444","55555","666666","7777777","88888888","999999999"};
short amp, freq, j;
for (int i = 1; i <= tc; i++){
cin >> amp;
cin >> freq;
for (short k = 1; k <= freq; k++){
for (j = 0; j < amp; j++){
cout << nums[j] << endl;
}
for (j -= 2; j >= 0; j--){
cout << nums[j] << endl;
}
if (k < freq){
cout << endl;
}
}
if (i < tc){
cout << endl;
}
}
}6
3
2
1
0
1
1
2
2
1
0
3
31
22
333
22
1
1
22
333
22
1
1
1
22
1
1
22
1
1
22
333
22
1
1
22
333
22
1
1
22
333
22
1 (no \n)#include <iostream>
using namespace std;
int main()
{
int t,a,f;
cin>>t;
for (int i=0;i<t;i++)
{
cin>>a>>f;
for (int i=0;i<f;i++)
{
for (int j=1;j<=a;j++)
{
cout<<j;
for (int k=1;k<j;k++)
{
cout<<j;
}
cout<<endl;
}
for (int x=a-1;x>0;x--)
{
cout<<x;
for (int y=x;y>1;y--)
{
cout<<x;
}
cout<<endl;
}
if (i==f-1) continue;
cout<<endl;
}
}
}2
3
2
4
31
22
333
22
1
1
22
333
22
1
1
22
333
4444
333
22
1
1
22
333
4444
333
22
1
1
22
333
4444
333
22
1
2
3
2
1
22
333
22
1
1
22
333
22
1
4
3
1
22
333
4444
333
22
1
1
22
333
4444
333
22
1
1
22
333
4444
333
22
1Users browsing this forum: No registered users and 1 guest