总是WA,过不去,求找错误!

P5737 【深基7.例3】闰年展示

zjy0419 @ 2023-12-16 21:00:58

include <bits/stdc++.h>

using namespace std; int main(){ int a,b; int c[500]; int d=0; cin>>a>>b; for(int i=a;i<=b;i++){ if(((i%4==0)&&(i%100!=0))||(i%400==0)){ c[d]=i; d+=1; } } cout << d << endl; for (int i=0;i<=d;i++){ cout << c[i]<<" "; } }


by No_Rest @ 2023-12-16 21:14:14

输出应该是 for (int i=0;i<d;i++){ cout << c[i]<<" "; } 吧。


by zjy0419 @ 2023-12-17 07:56:16

@ldf1208 成功了!谢谢!


|