Run ID |
作者 |
问题 |
语言 |
测评结果 |
分数 |
时间 |
内存 |
代码长度 |
提交时间 |
8008 |
D班-陈颖钧 |
s01串 |
C++ |
编译错误 |
0 |
0 MS
|
0 KB
|
292 |
2025-03-23 14:11:41 |
Tests(0/0):
#include<bits/stdc++.h>
using namespace std;
int i,n,j;
string a;
int main(){
cin>>n;
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
if(a[j]=="0"){
a[j]="1";
}else{
a[j]="01";
}
}
}
cout<<a;
}
测评信息:
Main.cc: In function ‘int main()’:
Main.cc:9:19: warning: comparison with string literal results in unspecified behavior [-Waddress]
9 | if(a[j]=="0"){
| ^~~
Main.cc:9:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:10:19: error: invalid conversion from ‘const char*’ to ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} [-fpermissive]
10 | a[j]="1";
| ^~~
| |
| const char*
Main.cc:12:19: error: invalid conversion from ‘const char*’ to ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} [-fpermissive]
12 | a[j]="01";
| ^~~~
| |
| const char*