ZhiSu2052 @ 2021-08-24 20:10:50
自己在电脑上测试和样例一样 但是全部都WA了求大佬帮忙康康 (语言:C++)
#include<iostream>
using namespace std;
bool run(short year){
if(year%100==0){//判断是否为世纪年
if(year%400==0){
return true;
}else{
return false;
}
}else{
if(year%4==0){
return true;
}else{
return false;
}
}
}
int main(){
unsigned short arr[1001]={};
unsigned short count=0;
unsigned short x;
unsigned short y;
cin>>x>>y;
for(int i=x;i<=y;i++){
if(run(i)){
arr[count]=i;
count++;
}
}
cout<<count<<endl;
for(int i=0;i<count;i++){
cout<<arr[i]<<" ";
}
cout<<"\b";
system("pause");
}
by S0CRiA @ 2021-08-24 20:12:55
system("pause");
去掉
by S0CRiA @ 2021-08-24 20:13:11
by Textbook_blasphemy @ 2021-08-24 20:13:45
@ZhiSu2052
删去main()
中最后2行
by _l_l_l_l_l_ @ 2021-08-24 20:24:23
cout<<"\b"
来backspace,没有必要结尾多了空格不会算错
by ZhiSu2052 @ 2021-08-24 20:59:21
好了谢谢各位大佬已经解决了