結果
| 問題 | 
                            No.8083 12歳
                             | 
                    
| コンテスト | |
| ユーザー | 
                             waidotto
                         | 
                    
| 提出日時 | 2023-01-02 03:37:39 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 70 ms / 1,000 ms | 
| コード長 | 617 bytes | 
| コンパイル時間 | 1,673 ms | 
| コンパイル使用メモリ | 192,588 KB | 
| 最終ジャッジ日時 | 2025-02-09 22:55:38 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 366 | 
ソースコード
#include <bits/stdc++.h>
bool isLeapYear(int y) {
    if(y % 400 == 0) return true;
    if(y % 100 == 0) return false;
    if(y % 4 == 0) return true;
    return false;
}
//Iverson bracket
int I(bool b) {
	return b ? 1 : 0;
}
int numberOfDays(int y) {
	return 365 + I(isLeapYear(y));
}
int main(void) {
    using namespace std;
    int Y, N, D;
    cin >> Y >> N >> D;
    int consumedPossibleBirthdays = D + I(D >= 334) * (I(isLeapYear(Y - 12)) - I(isLeapYear(Y + 1)));
    cout << N - min(N, consumedPossibleBirthdays) << ' ' << min(N, numberOfDays(Y - 12) - consumedPossibleBirthdays) << '\n';
    return 0;
}
            
            
            
        
            
waidotto