結果

問題 No.188 HAPPY DAY
ユーザー sper_air_readersper_air_reader
提出日時 2018-02-22 10:33:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 291 bytes
コンパイル時間 1,404 ms
コンパイル使用メモリ 166,964 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 22:15:10
合計ジャッジ時間 1,772 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:7:21: warning: iteration 11 invokes undefined behavior [-Waggressive-loop-optimizations]
    7 |                 int dayMax = days[i];
      |                     ^~~~~~
main.cpp:6:22: note: within this loop
    6 |         for(int i=1;i<13;i++){
      |                     ~^~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
	int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int ans = 0;
	for(int i=1;i<13;i++){
		int dayMax = days[i];
		for(int day=1;day<dayMax+2;day++){
			if(i+1==day/10+day%10)ans++;
		}
	}
	cout<<(ans)<<endl;
	return 0;
}
0