在devc++里编译成功,在洛谷里却编译失败

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

liyifan0804 @ 2023-08-02 08:51:25

#include<iostream>
using namespace std;
int ans[1500],begin,end,cnt=0;
int main(){
    cin>>begin>>end;
    for(int i=begin;i<=end;i++){
        if((i%4==0&&i%100!=0)||i%400==0){
            ans[cnt]=i;
            cnt++;
        }
    }
    cout<<cnt<<endl;
    for(int i=0;i<cnt;i++){
        cout<<ans[i]<<" ";
    }
    return 0;
}

by dthythxth_Huge_Brain @ 2023-08-02 08:53:16

@Evan20120804 beginend 是系统自带的函数


by dthythxth_Huge_Brain @ 2023-08-02 08:53:32

会CE


by dthythxth_Huge_Brain @ 2023-08-02 08:58:43

变量名改一下就好了


by liyifan0804 @ 2023-08-02 09:29:41

谢谢


|