本来想挑点难的题解的
直到我做的这道题
http://smoj.nhedu.net/showproblem?id=1000
只拿了80分
意思就是:我一初中生去做小学的两位数加减法还没拿满分
所以我就专门看看这道题什么情况
我原来做的:
#include<stdio.h>
using namespace std;
int main()
{
freopen("1000.in","r",stdin);
freopen("1000.out","w",stdout);
int a;
scanf("%d",&a);
a=a%100;
printf("%d",a);
return 0;
}
这题目意思就不用解释了吧
然后,经过我的调试大法后
我发现了一个问题:
我!@@#@#……&*&*¥&*()¥%%¥……#@&*(&¥#……%……)
那就改一下好了
#include<stdio.h>
using namespace std;
int main() {
freopen("1000.in","r",stdin);
freopen("1000.out","w",stdout);
int a;
scanf("%d",&a);
if(a==100)
a=100;
else if(a<100)
a=a;
else
a=a%100;
printf("%d",a);
return 0;
}
结果:
我!@@#@#……&*&*¥&*()¥%%¥……#@&*(&¥#……%……)
这道题成精了。
不对,这道题没成精,
是我思维有点问题a
既然100会输出0
那么200呢?
Pu——
果不其然,300肯定也是a
那么程序改一下就好了
#include<stdio.h>
using namespace std;
int main() {
//freopen("1000.in","r",stdin);
//freopen("1000.out","w",stdout);
int a;
scanf("%d",&a);
if(a%100==0)
a=100;
else if(a<100)
a=a;
else
a=a%100;
printf("%d",a);
return 0;
}
这次不可能错la
我就说嘛。。。。。。