I make mistakes on this problem's meaning.So I get WA many times.So sad.
The portal:http://acm.tju.edu.cn/toj/showp4109.html
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
int even_tot,odd_tot;
void Deal_with(){
int n;
while(scanf("%d",&n),n){
int temp;
even_tot = 0;
odd_tot = 0;
for(int i=0;i<n;i++){
scanf("%d",&temp);
if(temp&1){
odd_tot ++;
}
else {
even_tot ++;
}
}
if(odd_tot > even_tot && n % 2 == 1){
puts("Justice will prevail over evil.");
}
else if(even_tot > odd_tot && n % 2 == 0){
puts("While the priest climbs a post, the devil climbs ten.");
}
else {
puts("I love this world.");
}
}
}
int main(void){
freopen("a.in","r",stdin);
Deal_with();
return 0;
}
本文探讨了在解决编程问题时容易犯的错误,并通过具体案例分析,帮助开发者避免常见陷阱,提高编程效率。
1398

被折叠的 条评论
为什么被折叠?



