結果

問題 No.188 HAPPY DAY
ユーザー Tearon
提出日時 2016-09-03 19:51:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 276 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 55,800 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-31 01:03:17
合計ジャッジ時間 857 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:18: warning: iteration 11 invokes undefined behavior [-Waggressive-loop-optimizations]
    8 |     REP(j,month[i])
      |           ~~~~~~~^
main.cpp:2:39: note: in definition of macro ‘REP’
    2 | #define REP(i,n) for( int i = 1; i <= n; i++ )
      |                                       ^
main.cpp:2:36: note: within this loop
    2 | #define REP(i,n) for( int i = 1; i <= n; i++ )
      |                                    ^
main.cpp:7:3: note: in expansion of macro ‘REP’
    7 |   REP(i,12)
      |   ^~~

ソースコード

diff #

#include<iostream>
#define REP(i,n) for( int i = 1; i <= n; i++ )
using namespace std;
int main(){
  int cnt = 0;
  int month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  REP(i,12)
    REP(j,month[i])
      if( (j/10) + (j%10) == i ) cnt++;
  cout << cnt << '\n';
}
0