AtCoder Beginner Contest 007

Submission #1677283

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;
int main()
{
  string str;
  cin >> str;

  if (str == 'a')
    cout << -1 << endl;
  else
  {
    string shorter;
    for (int i = 0; i < str.length(); ++i){
      shorter.push_back('a');
    }
    cout << shorter << endl;
  }
  return 0;
}

Submission

Task問題 B - 辞書式順序
User nameユーザ名 aximov
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 CE
Score得点 -
Source lengthソースコード長 305 Byte
File nameファイル名
Exec time実行時間 -
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:8:11: error: no match for ‘operator==’ (operand types are ‘std::string {aka std::basic_string<char>}’ and ‘char’)
if (str == 'a')
^
In file included from /usr/include/c++/5/unordered_set:48:0,
from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:116,
from ./Main.cpp:1:
/usr/include/c++/5/bits/unordered_set.h:1421:5: note: candidate: template<class _Value, class _Hash, class _Pred, class _Alloc> bool std::operator==(const std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>&, const std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>&)
operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
^
/usr/include/c++/5/bits/unordered_set.h:1421:5: note: template argument deduction/substitution failed:
./Main.cpp:8:14: note: ‘std::string {aka std::basic_string<char>}’ is not derived from ‘const std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>’
if (str == 'a')
^
In fi...

Test case