/......................................................................................................................................................\
wa了好几次,不知道为什么,格式的输出一定注意,特别是小于10的数的输出,
还有输出是空格
\....................................................................................................................................................../
ac代码:
#include<stdio.h>
#include <iostream>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<list>
#include<vector>
#pragma comment(linker,"/STACK:102400000,102400000")
using namespace std;
int main()
{
int a,b,i,s[110],count,k;
while(scanf("%d%d",&a,&b),a||b)
{
k=0;
for(i=0;i<100;i++)
{
if((a*100+i)%b==0)
{
s[k++]=i;
}
}
printf("%02d",s[0]);
for(i=1;i<k;i++)
printf(" %02d",s[i]);
printf("\n");
}
return 0;
}
wa的代码:
看到的请解释下为什么?
#include<stdio.h>
#include <iostream>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<list>
#include<vector>
#pragma comment(linker,"/STACK:102400000,102400000")
using namespace std;
int main()
{
int a,b,i,s[110];
while(scanf("%d%d",&a,&b),a||b)
{
int k=0;
for(i=a*100;i<a*100+100;i++)
{
if(i%b==0)
s[k++]=i%a;
}
printf("%02d",s[0]);
for(i=1;i<k;i++)
printf(" %02d",s[i]);
printf("\n");
}
return 0;
}