提出 #819129


ソースコード 拡げる

#include <iostream>
#include <string>

int main () {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  std::string line;
  std::getline(std::cin, line);

  char * p = &*line.begin();

  std::size_t N = std::strtol(p, &p, 10);
  std::size_t L = std::strtol(p, &p, 10);

  std::getline(std::cin, line);

  std::size_t count = 0;
  std::size_t tab = 1;

  for (int i = 0; i < line.size(); ++i) {
    if (line[i] == '+') {
      tab += 1;
      if (tab > L) {
        count += 1;
        tab = 1;
      }
    } else {
      tab -= 1;
    }
  }
  std::cout << count << std::endl;
}

提出情報

提出日時
問題 A - タブの開きすぎ
ユーザ toufu12345
言語 C++ (GCC 4.9.2)
得点 0
コード長 616 Byte
結果 CE

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:19: error: ‘strtol’ is not a member of ‘std’
   std::size_t N = std::strtol(p, &p, 10);
                   ^
./Main.cpp:14:19: error: ‘strtol’ is not a member of ‘std’
   std::size_t L = std::strtol(p, &p, 10);
                   ^