結果

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) printf("%d\n",(x));
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;
template<class T> using V = vector<T>;
using I = int;
using VI = V<I>;
const int INF = 2e9;

template <class T> inline bool chmin(T& a, T b){if(a>b){a=b; return true;} return false;}
template <class T> inline bool chmax(T& a, T b){if(a<b){a=b; return true;} return false;}

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