結果

問題 No.9010 うるう年判定
ユーザー toririm_toririm_
提出日時 2019-11-30 13:35:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 1,357 ms
コンパイル使用メモリ 165,584 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 01:20:47
合計ジャッジ時間 2,146 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:17:5: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   17 |     if(ans)cout<<"Yes"<<endl;
      |     ^~
main.cpp:9:10: note: 'ans' was declared here
    9 |     bool ans;
      |          ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
#define int long long

signed main(){
    int n;cin>>n;
    bool ans;
    if(n%4==0){
        ans=true;
        if(n%100==0){
            ans=false;
            if(n%400==0)ans=true;
        }
    }
    if(ans)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
0