Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
82941 杜奕辰 只出现一次的字符 C++ Compile Error 0 MS 0 KB 300 2024-07-13 16:43:00

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ string n; cin>>n; int k; int len=n.size; for(int i=0;i<n.size();i++){ k=1; for(int j=i+1;j<len;j++){ if(n[i]==n[j]){ k++; } } if(k==1){ cout<<n[i]; return 0; } } cout<<"no"; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:12: error: cannot convert 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size, std::allocator >' from type 'std::__cxx11::basic_string::size_type (std::__cxx11::basic_string::)() const noexcept {aka long unsigned int (std::__cxx11::basic_string::)() const noexcept}' to type 'int'
  int len=n.size;
            ^
Main.cc:8:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i