結果

問題 No.9010 うるう年判定
ユーザー toririm_
提出日時 2019-11-30 13:35:37
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 387 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,324 ms
コンパイル使用メモリ 182,964 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2026-03-06 06:55:19
合計ジャッジ時間 1,487 ms
ジャッジサーバーID
(参考情報)
judge2 / 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 #
raw source code

#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