dwangoプログラミングコンテスト

Submission #1304440

Source codeソースコード

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
  char ch;
  ll res(0);
  ll current(0);
  int mode(5);
  while (cin >> ch) {
    if (mode == 5 && ch == '2') {
      mode = 2;
    } else if (mode == 5) {
      mode = 5;
      res += (current * (current + 1) / 2);
      current = 0;
    } else if (mode == 2 && ch == '5') {
      mode = 5;
      current++;
    } else if (mode == 2 && ch == '2') {
      mode = 2;
      res += (current * (current + 1) / 2);
      current = 0;
    } else if (mode == 2) {
      mode = 5;
      res += (current * (current + 1) / 2);
      current = 0;
    } else {
    }
  }
  res += (current * (current + 1) / 2);
  cout << res << endl;
}

Submission

Task問題 B - ニコニコ文字列
User nameユーザ名 fof
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 741 Byte
File nameファイル名
Exec time実行時間 8 ms
Memory usageメモリ使用量 256 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - subtask0_sample_01.txt,subtask0_sample_02.txt,subtask0_sample_03.txt,subtask0_sample_04.txt,subtask0_sample_05.txt
Subtask1 30 / 30 subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask0_sample_01.txt,subtask0_sample_02.txt,subtask0_sample_03.txt,subtask0_sample_04.txt,subtask0_sample_05.txt
All 70 / 70 subtask0_sample_01.txt,subtask0_sample_02.txt,subtask0_sample_03.txt,subtask0_sample_04.txt,subtask0_sample_05.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt,subtask2_10.txt,subtask2_11.txt,subtask2_12.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
subtask0_sample_01.txt AC 1 ms 256 KB
subtask0_sample_02.txt AC 1 ms 256 KB
subtask0_sample_03.txt AC 1 ms 256 KB
subtask0_sample_04.txt AC 1 ms 256 KB
subtask0_sample_05.txt AC 1 ms 256 KB
subtask1_01.txt AC 2 ms 256 KB
subtask1_02.txt AC 1 ms 256 KB
subtask1_03.txt AC 1 ms 256 KB
subtask1_04.txt AC 1 ms 256 KB
subtask1_05.txt AC 1 ms 256 KB
subtask1_06.txt AC 1 ms 256 KB
subtask1_07.txt AC 1 ms 256 KB
subtask1_08.txt AC 1 ms 256 KB
subtask1_09.txt AC 1 ms 256 KB
subtask1_10.txt AC 1 ms 256 KB
subtask1_11.txt AC 1 ms 256 KB
subtask1_12.txt AC 1 ms 256 KB
subtask1_13.txt AC 1 ms 256 KB
subtask2_01.txt AC 8 ms 256 KB
subtask2_02.txt AC 7 ms 256 KB
subtask2_03.txt AC 8 ms 256 KB
subtask2_04.txt AC 7 ms 256 KB
subtask2_05.txt AC 7 ms 256 KB
subtask2_06.txt AC 7 ms 256 KB
subtask2_07.txt AC 6 ms 256 KB
subtask2_08.txt AC 6 ms 256 KB
subtask2_09.txt AC 2 ms 256 KB
subtask2_10.txt AC 2 ms 256 KB
subtask2_11.txt AC 2 ms 256 KB
subtask2_12.txt AC 2 ms 256 KB