結果

問題 No.188 HAPPY DAY
コンテスト
ユーザー abcodama
提出日時 2017-07-12 00:22:35
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 1,000 ms
+ 995µs
コード長 533 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 252 ms
コンパイル使用メモリ 71,220 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-10-09 19:29:58
合計ジャッジ時間 1,055 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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