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

Submission #1304428

Source codeソースコード

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
  string s;
  cin >> s;
  char ch;
  ll res;
  ll current(0);
  int mode(5);
  for (int i = 0; i < s.size(); ++i) {
    ch = s[i];
    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;
    }
  }
  cout << res << endl;
}

Submission

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

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 0 / 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 0 / 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 WA
subtask0_sample_02.txt WA
subtask0_sample_03.txt WA
subtask0_sample_04.txt WA
subtask0_sample_05.txt WA
subtask1_01.txt WA
subtask1_02.txt WA
subtask1_03.txt WA
subtask1_04.txt WA
subtask1_05.txt WA
subtask1_06.txt WA
subtask1_07.txt WA
subtask1_08.txt WA
subtask1_09.txt WA
subtask1_10.txt WA
subtask1_11.txt WA
subtask1_12.txt WA
subtask1_13.txt WA
subtask2_01.txt WA
subtask2_02.txt WA
subtask2_03.txt WA
subtask2_04.txt WA
subtask2_05.txt WA
subtask2_06.txt WA
subtask2_07.txt WA
subtask2_08.txt WA
subtask2_09.txt WA
subtask2_10.txt WA
subtask2_11.txt WA
subtask2_12.txt WA