結果

問題 No.188 HAPPY DAY
ユーザー abcodamaabcodama
提出日時 2017-07-12 00:22:35
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 533 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 54,448 KB
実行使用メモリ 6,816 KB
最終ジャッジ日時 2024-12-31 01:51:43
合計ジャッジ時間 810 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <ctime>
using namespace std;

class calender{
  const int YEAR = 2015;
  struct tm base = {0,0,0,1,0,YEAR}, *tt;
public:
  bool next(){
    time_t t = mktime(&base);
    tt = localtime(&t);
    base.tm_mday++;
    return tt->tm_year == YEAR;
  }
  bool happyday(){
    return (tt->tm_mon == (tt->tm_mday / 10) + (tt->tm_mday % 10) - 1);
  }
};

int main(){
  calender c;
  int happyday = 0;
  for(; c.next(); ){
    if(c.happyday()){
      happyday++;
    }
  }
  cout << happyday << endl;
  return 0;
}
0