submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s291472161
|
p00017
|
C++
|
char*c;a[99];main(){for(scanf("%[^\n]",a);!(strstr(a,"this")||strstr(a,"that")||strstr(a,"the"));)for(c=a;*c;c++)*c<97||(*c=(*c+8)%26+97);puts(a);}
|
a.cc:1:8: error: 'a' does not name a type
1 | char*c;a[99];main(){for(scanf("%[^\n]",a);!(strstr(a,"this")||strstr(a,"that")||strstr(a,"the"));)for(c=a;*c;c++)*c<97||(*c=(*c+8)%26+97);puts(a);}
| ^
a.cc:1:14: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | char*c;a[99];main(){for(scanf("%[^\n]",a);!(strstr(a,"this")||strstr(a,"that")||strstr(a,"the"));)for(c=a;*c;c++)*c<97||(*c=(*c+8)%26+97);puts(a);}
| ^~~~
a.cc: In function 'int main()':
a.cc:1:40: error: 'a' was not declared in this scope
1 | char*c;a[99];main(){for(scanf("%[^\n]",a);!(strstr(a,"this")||strstr(a,"that")||strstr(a,"the"));)for(c=a;*c;c++)*c<97||(*c=(*c+8)%26+97);puts(a);}
| ^
a.cc:1:25: error: 'scanf' was not declared in this scope
1 | char*c;a[99];main(){for(scanf("%[^\n]",a);!(strstr(a,"this")||strstr(a,"that")||strstr(a,"the"));)for(c=a;*c;c++)*c<97||(*c=(*c+8)%26+97);puts(a);}
| ^~~~~
a.cc:1:45: error: 'strstr' was not declared in this scope
1 | char*c;a[99];main(){for(scanf("%[^\n]",a);!(strstr(a,"this")||strstr(a,"that")||strstr(a,"the"));)for(c=a;*c;c++)*c<97||(*c=(*c+8)%26+97);puts(a);}
| ^~~~~~
a.cc:1:1: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
+++ |+#include <cstring>
1 | char*c;a[99];main(){for(scanf("%[^\n]",a);!(strstr(a,"this")||strstr(a,"that")||strstr(a,"the"));)for(c=a;*c;c++)*c<97||(*c=(*c+8)%26+97);puts(a);}
a.cc:1:144: error: 'a' was not declared in this scope
1 | char*c;a[99];main(){for(scanf("%[^\n]",a);!(strstr(a,"this")||strstr(a,"that")||strstr(a,"the"));)for(c=a;*c;c++)*c<97||(*c=(*c+8)%26+97);puts(a);}
| ^
a.cc:1:139: error: 'puts' was not declared in this scope
1 | char*c;a[99];main(){for(scanf("%[^\n]",a);!(strstr(a,"this")||strstr(a,"that")||strstr(a,"the"));)for(c=a;*c;c++)*c<97||(*c=(*c+8)%26+97);puts(a);}
| ^~~~
|
s528541328
|
p00017
|
C++
|
char*p;c[99];
main(){
for(;~scanf("%[^\n] ",p=c);puts(c))
for(;(*p++=*p>96?*p%96%26+97:*p)||!strstr(p=c,"th"););
}
|
a.cc:1:8: error: 'c' does not name a type
1 | char*p;c[99];
| ^
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:3:29: error: 'c' was not declared in this scope
3 | for(;~scanf("%[^\n] ",p=c);puts(c))
| ^
a.cc:3:11: error: 'scanf' was not declared in this scope
3 | for(;~scanf("%[^\n] ",p=c);puts(c))
| ^~~~~
a.cc:3:32: error: 'puts' was not declared in this scope
3 | for(;~scanf("%[^\n] ",p=c);puts(c))
| ^~~~
a.cc:4:44: error: 'strstr' was not declared in this scope
4 | for(;(*p++=*p>96?*p%96%26+97:*p)||!strstr(p=c,"th"););
| ^~~~~~
a.cc:1:1: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
+++ |+#include <cstring>
1 | char*p;c[99];
|
s514968734
|
p00017
|
C++
|
#include<iostream>
#include<cstring>
#include<stdio.h>
using namespace std;
int main(){
char a[100],b[100];
for(int i;i<100;i++){
a[i]='\0';
b[i]='\0';
}
gets(a);
int i=0;
while(i<26){
for(int j=0;!(a[j]=='\0');j++){
if(0x61<=a[j]+i&&a[j]+i<=0x7A)
b[j]+=i;
else if(0x61<=a[j]&&a[j]<=0x7A){
b[j]=a[j]-26+i;
}
else if(a[j]==' ')
b[j]=' ';
else if(a[j]=='.')
b[j]='.';
}
if(strstr(b,"the")||strstr(b,"this")||strstr(b,"that"))
break;
i++;
}
for(int k=0;a[k]!='\0';k++)
cout<<b[k];
cout<<'\n';
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:3: error: 'gets' was not declared in this scope; did you mean 'getw'?
12 | gets(a);
| ^~~~
| getw
|
s258229586
|
p00017
|
C++
|
#include<iostream>
#include<cstring>
#include<stdio.h>
using namespace std;
int main(){
char a[100],b[100];
for(int i;i<100;i++){
a[i]='\0';
b[i]='\0';
}
gets(a);
int i=0;
while(i<26){
for(int j=0;!(a[j]=='\0');j++){
if(0x61<=a[j]+i&&a[j]+i<=0x7A)
b[j]+=i;
else if(0x61<=a[j]&&a[j]<=0x7A){
b[j]=a[j]-26+i;
}
else if(a[j]==' ')
b[j]=' ';
else if(a[j]=='.')
b[j]='.';
}
if(strstr(b,"the")||strstr(b,"this")||strstr(b,"that"))
break;
i++;
}
for(int k=0;a[k]!='\0';k++)
cout<<b[k];
cout<<'\n';
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:3: error: 'gets' was not declared in this scope; did you mean 'getw'?
12 | gets(a);
| ^~~~
| getw
|
s450633658
|
p00017
|
C++
|
#include<iostream>
#include<cstring>
#include<stdio.h>
using namespace std;
int main(){
char a[100],b[100];
for(int i;i<100;i++){
a[i]='\0';
b[i]='\0';
}
gets(a);
int i=0;
while(i<26){
for(int j=0;!(a[j]=='\0');j++){
if(0x61<=a[j]+i&&a[j]+i<=0x7A)
b[j]+=i;
else if(0x61<=a[j]&&a[j]<=0x7A){
b[j]=a[j]-26+i;
}
else if(a[j]==' ')
b[j]=' ';
else if(a[j]=='.')
b[j]='.';
}
if(strstr(b,"the")||strstr(b,"this")||strstr(b,"that"))
break;
i++;
}
for(int k=0;a[k]!='\0';k++)
cout<<b[k];
cout<<'\n';
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:3: error: 'gets' was not declared in this scope; did you mean 'getw'?
12 | gets(a);
| ^~~~
| getw
|
s497141967
|
p00017
|
C++
|
#include<string.h>
#include<stdio.h>
using namespace std;
int main(){
char a[100],b[100];
for(int i;i<100;i++){
a[i]='\0';
b[i]='\0';
}
gets(a);
int i=0;
while(i<26){
for(int j=0;!(a[j]=='\0');j++){
if(0x61<=a[j]+i&&a[j]+i<=0x7A)
b[j]+=i;
else if(0x61<=a[j]&&a[j]<=0x7A){
b[j]=a[j]-26+i;
}
else if(a[j]==' ')
b[j]=' ';
else if(a[j]=='.')
b[j]='.';
}
if(strstr(b,"the")||strstr(b,"this")||strstr(b,"that"))
break;
i++;
}
for(int k=0;a[k]!='\0';k++)
printf("%s",b[k]);
printf("\n");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:3: error: 'gets' was not declared in this scope; did you mean 'getw'?
11 | gets(a);
| ^~~~
| getw
|
s160956151
|
p00017
|
C++
|
#include<string>
using namespace std;
int main(){
string s, strc;
while(getline(cin,s)){
for(int j=0;j<26;j++){
if(s.find("the")!=string::npos ||s.find("this")!=string::npos||s.find("that")!=string::npos ){
cout << s << endl;
}
for(int i=0;i<s.size();i++){//size()ツづ債閉カツ篠堋療アツづ個陳キツつウツづーツ陛板つキ
if(s[i]=='z')s[i]='a';
else if(s[i]>='a'&&s[i]<='z')s[i]++;
}
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:17: error: 'cin' was not declared in this scope
11 | while(getline(cin,s)){
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<string>
+++ |+#include <iostream>
3 |
a.cc:17:9: error: 'cout' was not declared in this scope
17 | cout << s << endl;
| ^~~~
a.cc:17:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:22: error: 'endl' was not declared in this scope
17 | cout << s << endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include<string>
+++ |+#include <ostream>
3 |
|
s212056434
|
p00017
|
C++
|
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
string dict = "abcdefghijklmnopqrstuvxwyz";
string decode(string s, int v) {
string ans = s;
for(int i = 0; i < (int) s.size(); i++) {
if(s[i] >= 'a' && s[i] <= 'z') {
ans[i] = dict[((s[i] + v) % 26)];
}
}
return ans;
}
int main() {
string s;
while(getline(cin, s)) {
if(s.size <= 1) break;
for(int i = 1; ; i++) {
string tmp = decode(s, i);
if(tmp.find("this") != string::npos && tmp.find("the") != string::npos && tmp.find("that") != string::npos) {
cout << tmp << endl;
break;
}
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:23:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
23 | if(s.size <= 1) break;
| ~~^~~~
| ()
|
s484264167
|
p00017
|
C++
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char str[81];
while(gets(str) != NULL)
{
int i,j;
int len = strlen(str);
for(i = 0;i < 26;i++)
{
for(j = 0;j < len;j++)
{
if(str[j] >= 'a' && str[j] <= 'z')
{
str[j] = (str[j] - 'a' + 1) % 26 + 'a';
}
}
for(j = 0;j < len-2;j++)
{
if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'e')
{
puts(str);
break;
}
}
if(j != len-2)
break;
for(j = 0;j < len-3;j++)
{
if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'i' && str[j+3] == 's')
{
puts(str);
break;
}
}
if(j != len-3)
break;
for(j = 0;j < len-3;j++)
{
if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'a' && str[j+3] == 't')
{
puts(str);
break;
}
}
if(j != len-3)
break;
}
}
}
|
a.cc: In function 'int main()':
a.cc:8:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
8 | while(gets(str) != NULL)
| ^~~~
| getw
|
s810491281
|
p00017
|
C++
|
#include <stdio.h>
#include <conio.h>
char* Rest(char *before, char lag);
int main(void)
{
char before[1000];
scanf("%[^\n]", before);
if (before[0] == 't'){
printf("%s\n", before);
}
else if (before[0] < 't'){
printf("%s\n", Rest(before, 't' - before[0]));
}
else if (before[0] > 't'){
printf("%s\n", Rest(before, before[0] - 't'));
}
return (0);
}
char* Rest(char *before, char lag)
{
int i;
char ans[1000];
for (i = 0; before[i] != '\0'; i++){
if (before[i] >= 'a' && before[i] <= 'z' ||
before[i] >= 'A' && before[i] <= 'Z'){
if (before[i] - lag < 'a'){
ans[i] = before[i] - lag + 26;
}
else if (before[i] - lag > 'z'){
ans[i] = before[i] - lag - 26;
}
else {
ans[i] = before[i] - lag;
}
}
else {
ans[i] = before[i];
}
}
ans[i] = '\0';
return (ans);
}
|
a.cc:2:10: fatal error: conio.h: No such file or directory
2 | #include <conio.h>
| ^~~~~~~~~
compilation terminated.
|
s373855974
|
p00017
|
C++
|
#include <stdio.h>
#include <conio.h>
void Rest(char *before, char lag);
char ans[81];
int main(void)
{
char before[81];
scanf("%[^\n]", before);
if (before[0] == 't'){
printf("%s\n", before);
}
else if (before[0] < 't'){
Rest(before, 't' - before[0]);
printf("%s\n", ans);
}
else if (before[0] > 't'){
Rest(before, before[0] - 't');
printf("%s\n", ans);
}
return (0);
}
void Rest(char *before, char lag)
{
int i;
for (i = 0; before[i] != '\0'; i++){
if (before[i] >= 'a' && before[i] <= 'z' ||
before[i] >= 'A' && before[i] <= 'Z'){
if (before[i] - lag < 'a'){
ans[i] = before[i] - lag + 26;
}
else if (before[i] - lag > 'z'){
ans[i] = before[i] - lag - 26;
}
else {
ans[i] = before[i] - lag;
}
}
else {
ans[i] = before[i];
}
}
ans[i] = '\0';
}
|
a.cc:2:10: fatal error: conio.h: No such file or directory
2 | #include <conio.h>
| ^~~~~~~~~
compilation terminated.
|
s405017187
|
p00017
|
C++
|
#include <cctype>
#include <cstdio>
using namespace std;
int k = 0;
char enc(char c) {
return (c-'a'+k)%26+'a';
}
char dec(char c) {
if (!islower(c))
return c;
return (c-'a'+26-k)%26+'a';
}
int main() {
char s[128];
while (gets(s)) {
char *c = s;
state_delim:
switch (*c) {
case '.':
case ' ':
*c++;
goto state_delim;
default:
goto state_start;
}
state_start:
if (islower(*c)) {
k = (*c-'t'+26)%26;
goto state_t;
}
goto state_delim;
state_t:
*c++;
if (islower(*c)) {
if (*c == enc('h'))
goto state_h;
goto state_word;
}
goto state_delim;
state_h:
*c++;
if (islower(*c)) {
if (*c == enc('e'))
goto state_accept;
if (*c == enc('i'))
goto state_i;
if (*c == enc('a'))
goto state_a;
goto state_word;
}
goto state_delim;
state_i:
*c++;
if (islower(*c)) {
if (*c == enc('s'))
goto state_accept;
goto state_word;
}
goto state_delim;
state_a:
*c++;
if (islower(*c)) {
if (*c == enc('t'))
goto state_accept;
goto state_word;
}
goto state_delim;
state_word:
*c++;
if (islower(*c))
goto state_word;
goto state_delim;
state_accept:
*c++;
if (!islower(*c))
goto decode;
goto state_word;
decode:
c = s;
while (*c)
printf("%c", dec(*c++));
puts("");
}
}
|
a.cc: In function 'int main()':
a.cc:20:10: error: 'gets' was not declared in this scope; did you mean 'getw'?
20 | while (gets(s)) {
| ^~~~
| getw
|
s878078905
|
p00017
|
C++
|
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <string>
using namespace std;
static const int MAXV = 81;
bool hantei(char data[]);
void irekae(char data[]);
int main() {
while(!feof(stdin)) {
char data[MAXV];
if(fgets(data, sizeof(data), stdin)==NULL) break;
while(!hantei(data))
irekae(data);
printf("%s", data);
}
}
bool hantei(char data[]) {
if(strstr(data, "the")) return 1;
if(strstr(data, "this")) return 1;
if(strstr(data, "that")) return 1;
return 0;
}
void irekae(char data[]) {
for(int i=0;data[i]!=0;i++) {
if(data[i]>='a' && data[i]<='z') {
if(data[i]=='z')data[i]='a';
else data[i]++;
}
}
}
|
a.cc: In function 'bool hantei(char*)':
a.cc:23:6: error: 'strstr' was not declared in this scope
23 | if(strstr(data, "the")) return 1;
| ^~~~~~
a.cc:3:1: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cstdio>
+++ |+#include <cstring>
3 | #include <stdio.h>
a.cc:24:6: error: 'strstr' was not declared in this scope
24 | if(strstr(data, "this")) return 1;
| ^~~~~~
a.cc:24:6: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:25:6: error: 'strstr' was not declared in this scope
25 | if(strstr(data, "that")) return 1;
| ^~~~~~
a.cc:25:6: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s606427469
|
p00017
|
C++
|
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <string>
using namespace std;
static const int MAXV = 81;
bool hantei(char* data);
void irekae(char* data);
int main() {
while(!feof(stdin)) {
char data[MAXV];
if(fgets(data, sizeof(data), stdin)==NULL) break;
while(!hantei(data))
irekae(data);
printf("%s", data);
}
}
bool hantei(char* data) {
if(strstr(data, "the")) return 1;
if(strstr(data, "this")) return 1;
if(strstr(data, "that")) return 1;
return 0;
}
void irekae(char* data) {
for(int i=0;data[i]!=0;i++) {
if(data[i]>='a' && data[i]<='z') {
if(data[i]=='z')data[i]='a';
else data[i]++;
}
}
}
|
a.cc: In function 'bool hantei(char*)':
a.cc:23:6: error: 'strstr' was not declared in this scope
23 | if(strstr(data, "the")) return 1;
| ^~~~~~
a.cc:3:1: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cstdio>
+++ |+#include <cstring>
3 | #include <stdio.h>
a.cc:24:6: error: 'strstr' was not declared in this scope
24 | if(strstr(data, "this")) return 1;
| ^~~~~~
a.cc:24:6: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:25:6: error: 'strstr' was not declared in this scope
25 | if(strstr(data, "that")) return 1;
| ^~~~~~
a.cc:25:6: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s347040575
|
p00017
|
C++
|
while line = STDIN.gets
len = line.length
while !(line =~ /(the|this|that)/)
for i in 0..len-1 do
if( line[i,1] =~ /[a-z]/)
if(line[i,1] =~ /z/)
line[i] = "a"
else
line[i] = line[i].succ
end
end
end
end
puts line
end
|
a.cc:7:26: error: too many decimal points in number
7 | for i in 0..len-1 do
| ^~~~~~
a.cc:1:1: error: expected unqualified-id before 'while'
1 | while line = STDIN.gets
| ^~~~~
|
s743482262
|
p00017
|
C++
|
using namespace std;
char shiftch(char p, int n){
int t;
if('A'<= p && p <='Z'){
p-='A';
if(n<0) n+=26;
p+=n;
p%=26;
p+='A';
return p;
}
else if('a'<= p && p <='z'){
p-='a';
if(n<0) n+=26;
p+=n;
p%=26;
p+='a';
return p;
}
else return p;
}
int checkch(char p){
if('A'<= p && p <='Z') return 2;
else if('a'<= p && p <='z') return 1;
else return 0;
}
int main(){
int i, j, n;
char in[1000], w[5], *p, *tp;
p= in;
scanf("%[^\n]", in);
n= strlen(in);
// printf("%d\n", n);
while(1){
tp=p;
for(i=0; *(p++)!=' '; i++);
if(i==3||i==4){
j=*tp-'t'; if(*(tp+1)=='h'+j) break;
j=*tp-'T'; if(*(tp+1)=='h'+j){
j+='a'-'A';
break;
}
}
// ++p;
}
for(i=0; i<n; i++) in[i]=shiftch(in[i],-j);
printf("%s\n",in);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:41:9: error: 'scanf' was not declared in this scope
41 | scanf("%[^\n]", in);
| ^~~~~
a.cc:42:12: error: 'strlen' was not declared in this scope
42 | n= strlen(in);
| ^~~~~~
a.cc:1:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
+++ |+#include <cstring>
1 |
a.cc:60:9: error: 'printf' was not declared in this scope
60 | printf("%s\n",in);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 |
|
s987607090
|
p00017
|
C++
|
if('A'<= p && p <='Z'){
p-='A';
if(n<0) n+=26;
p+=n;
p%=26;
p+='A';
return p;
}
else if('a'<= p && p <='z'){
p-='a';
if(n<0) n+=26;
p+=n;
p%=26;
p+='a';
return p;
}
else return p;
}
/*
int checkch(char p){
if('A'<= p && p <='Z') return 2;
else if('a'<= p && p <='z') return 1;
else return 0;
}
*/
int main(){
int i, j, n;
char in[1000], *p, *tp;
p= in;
scanf("%[^\n]", in);
for(n=0; 16<=in[n] && in[n]<=126; n++);
// printf("%d\n", --n);
while(1){
tp=p;
for(i=0; *(p++)!=' '; i++);
if(i==3||i==4){
j=*tp-'t'; if(*(tp+1)=='h'+j) break;
j=*tp-'T'; if(*(tp+1)=='h'+j){
j+='a'-'A';
break;
}
}
}
for(i=0; i<n; i++) in[i]=shiftch(in[i],-j);
printf("%s\n",in);
return 0;
}
|
a.cc:1:9: error: expected unqualified-id before 'if'
1 | if('A'<= p && p <='Z'){
| ^~
a.cc:9:9: error: expected unqualified-id before 'else'
9 | else if('a'<= p && p <='z'){
| ^~~~
a.cc:17:9: error: expected unqualified-id before 'else'
17 | else return p;
| ^~~~
a.cc:18:1: error: expected declaration before '}' token
18 | }
| ^
a.cc: In function 'int main()':
a.cc:33:9: error: 'scanf' was not declared in this scope
33 | scanf("%[^\n]", in);
| ^~~~~
a.cc:49:39: error: 'shiftch' was not declared in this scope
49 | for(i=0; i<n; i++) in[i]=shiftch(in[i],-j);
| ^~~~~~~
a.cc:51:9: error: 'printf' was not declared in this scope
51 | printf("%s\n",in);
| ^~~~~~
a.cc:1:8: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | if('A'<= p && p <='Z'){
|
s811620026
|
p00017
|
C++
|
#include<iostream>
#include<ctype>
#include<string>
using namespace std;
bool find(string s){
return s.find("the",0)!=string::npos
|| s.find("this",0)!=string::npos
|| s.find("that",0)!=string::npos;
}
string rotate(string s,int n){
for(int i=0;i<s.size();i++){
if(isalpha(s[i]))s[i] = (s[i]-'a'+n)%26+'a';
}
return s;
}
int main(){
string s;
while(getline(cin,s)){
for(int i=0;i<26;i++){
if(find(rotate(s,i))){
cout<<rotate(s,i)<<endl;
break;
}
}
}
return 0;
}
|
a.cc:2:9: fatal error: ctype: No such file or directory
2 | #include<ctype>
| ^~~~~~~
compilation terminated.
|
s047679940
|
p00017
|
C++
|
#include <iostream>
#include <complex>
#include <cmath>
#include <cstdio>
#include <string>
#include <sstream>
using namespace std;
string rotate(string str) {
for (int i = 0; i < str.size(); i++) {
if ('a' <= str[i] && str[i] < 'z')str[i]++;
else if (str[i] == 'z')str[i] = 'a';
}
return str;
}
int main() {
string str;
while(getline(cin, str)) {
for (int i = 0; i < 26; i++) {
str = rotate(str);
string tmp;
bool flg = false;
for (int i = 0; i < str.size(); i++) {
if (str[i] != '.')tmp += str[i];
}
stringstream ss(tmp);
while(ss >> tmp) {
if (tmp == "the" || tmp == "this" || tmp == "that")flg = true;
break;
}
if (flg) {
cout << str << endl;
break;
}
if (i == 25)return 1;
}
}
return 0;
}
#include <iostream>
#include <complex>
#include <cmath>
#include <cstdio>
#include <string>
#include <sstream>
using namespace std;
string rotate(string str) {
for (int i = 0; i < str.size(); i++) {
if ('a' <= str[i] && str[i] < 'z')str[i]++;
else if (str[i] == 'z')str[i] = 'a';
}
return str;
}
int main() {
string str;
while(getline(cin, str)) {
for (int i = 0; i < 26; i++) {
str = rotate(str);
string tmp;
bool flg = false;
for (int i = 0; i < str.size(); i++) {
if (str[i] != '.')tmp += str[i];
}
stringstream ss(tmp);
while(ss >> tmp) {
if (tmp == "the" || tmp == "this" || tmp == "that")flg = true;
break;
}
if (flg) {
cout << str << endl;
break;
}
}
}
return 0;
}
|
a.cc:51:8: error: redefinition of 'std::string rotate(std::string)'
51 | string rotate(string str) {
| ^~~~~~
a.cc:10:8: note: 'std::string rotate(std::string)' previously defined here
10 | string rotate(string str) {
| ^~~~~~
a.cc:59:5: error: redefinition of 'int main()'
59 | int main() {
| ^~~~
a.cc:18:5: note: 'int main()' previously defined here
18 | int main() {
| ^~~~
|
s249598642
|
p00017
|
C++
|
#include <stdio.h>
int main(void)
{
char str[100];
int num;
int i;
while (fgets(str, 99, stdin) != EOF){
num = 't' - str[0];
i = 0;
while (str[i] != '\0'){
if ((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z')){
str[i] += num;
}
i++;
}
printf("%s", str);
}
printf("\n");
return (0);
}
|
a.cc: In function 'int main()':
a.cc:9:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | while (fgets(str, 99, stdin) != EOF){
| ^
|
s050190031
|
p00017
|
C++
|
import sys
def ceaser_decode(text):
d={}
line=""
for n in range(26):
for c in (65,97):
for i in range(26):
d[chr(i+c)] = chr((i+n)%26+c)
line = "".join([d.get(c,c) for c in text])
if line.find("the")!=-1 or line.find("this")!=-1 or line.find("that")!=-1:
break
return line
for i in sys.stdin.readlines():
print ceaser_decode(i),
|
a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:5: error: 'line' does not name a type
5 | line=""
| ^~~~
|
s372898980
|
p00017
|
C++
|
#include<cstdio>
#include<cstring>
#include<iostream>
#include<windows.h>
using namespace std;
int main(){
char a[100];
while(scanf("%[^\n]",a) != EOF){
bool flg = 0;
for(int i = 1; i < 26; i++){
unsigned char ans[100] = {0};
for(int j = 0; j < strlen(a); j++){
if(a[j] == ' ' || a[j] == '.') ans[j] = a[j];
else ans[j] = a[j] + i;
if(ans[j] > 'z') ans[j] -= 26;
}
for(int j = 0; j < strlen(a); j++){
if(ans[j] == 't' && ans[j+1] == 'h'){
if(ans[j+2] == 'e' && ans[j+3] == ' ')flg = 1;
if(ans[j+2] == 'i' && ans[j+3] == 's' && ans[j+4] == ' ')flg = 1;
if(ans[j+2] == 'a' && ans[j+3] == 't' && ans[j+4] == ' ')flg = 1;
}
if(flg){
if(j == 0){
cout << ans << endl;
goto end;
}
else{
if(ans[j-1] == ' '){
cout << ans << endl;
goto end;
}
}
}
}
}
end:;
fflush(stdin);
}
return 0;
}
|
a.cc:4:9: fatal error: windows.h: No such file or directory
4 | #include<windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s153902959
|
p00017
|
C++
|
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main() {
string st;
string w[3]={"the","this","that"};
int wn[3]={3,4,4},k,i,j,s,f;
while(getline(cin,st)) {
cout << st.size() << endl;
k=0;
while(k<st.size()) {
for (i=0;i<3;i++) {
s=0; f=0;
if (st.size()<k+wn[i]) break;
for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
if (s==wn[i]-1) { f=1; i=5; }
}
if (f==1) break;
k++;
}
if (f==0) cout << st; else {
for (i=0;i<st.size();i++) if ((st[i]>='a' && st[i]<='z')) cout << (char)(st[i]-(st[k]-'t')) ; else cout << st[i];
}
cout << endl;
}
|
a.cc: In function 'int main()':
a.cc:27:10: error: expected '}' at end of input
27 | }
| ^
a.cc:6:12: note: to match this '{'
6 | int main() {
| ^
|
s608692591
|
p00017
|
C++
|
#include <stdio.h>
using namespace std;
int main() {
string st;
string w[3]={"the","this","that"};
int wn[3]={3,4,4},k,i,j,s,f;
while(getline(cin,st)) {
k=0;
while(k<st.size()) {
for (i=0;i<3;i++) {
s=0; f=0;
if (st.size()<k+wn[i]) break;
for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
if (s==wn[i]-1) { f=1; i=5;}
}
if (f==1) break;
k++;
}
if (f==0) cout << st; else {
for (i=0;i<st.size();i++) if ((st[i]>='a' && st[i]<='z')) cout << (char)(st[i]-(st[k]-'t')) ; else cout << st[i];
}
cout << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:5:9: error: 'string' was not declared in this scope
5 | string st;
| ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
1 | #include <stdio.h>
+++ |+#include <string>
2 | using namespace std;
a.cc:6:15: error: expected ';' before 'w'
6 | string w[3]={"the","this","that"};
| ^~
| ;
a.cc:8:23: error: 'cin' was not declared in this scope
8 | while(getline(cin,st)) {
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <stdio.h>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:8:27: error: 'st' was not declared in this scope; did you mean 's'?
8 | while(getline(cin,st)) {
| ^~
| s
a.cc:14:54: error: 'w' was not declared in this scope
14 | for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
| ^
a.cc:20:19: error: 'cout' was not declared in this scope
20 | if (f==0) cout << st; else {
| ^~~~
a.cc:20:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:67: error: 'cout' was not declared in this scope
21 | for (i=0;i<st.size();i++) if ((st[i]>='a' && st[i]<='z')) cout << (char)(st[i]-(st[k]-'t')) ; else cout << st[i];
| ^~~~
a.cc:21:67: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:108: error: 'cout' was not declared in this scope
21 | for (i=0;i<st.size();i++) if ((st[i]>='a' && st[i]<='z')) cout << (char)(st[i]-(st[k]-'t')) ; else cout << st[i];
| ^~~~
a.cc:21:108: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:9: error: 'cout' was not declared in this scope
23 | cout << endl;
| ^~~~
a.cc:23:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:17: error: 'endl' was not declared in this scope
23 | cout << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <stdio.h>
+++ |+#include <ostream>
2 | using namespace std;
|
s857633873
|
p00017
|
C++
|
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main() {
char st[80];
string w[3]={"the","this","that"};
int wn[3]={3,4,4},k,i,j,s,f,z;
while(true) {
k=0; z=0;
scanf("%[^\0]",st);
z=strlen(st);
while(k<z) {
for (i=0;i<3;i++) {
s=0; f=0;
if (z<k+wn[i]) break;
for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
if (s==wn[i]-1 && (st[k+wn[i]]<'a' || st[k+wn[i]]>'z' )) { f=1; i=5;}
}
if (f==1) break;
for (k;st[k]>='a' && st[k]<='z';k++);
k++;
}
if (f==0) cout << st; else {
for (i=0;i<z+1;i++) if ((st[i]>='a' && st[i]<='z')) cout << (char)(st[i]-(st[k]-'t')) ; else cout << st[i];
}
cout << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:11: error: 'strlen' was not declared in this scope
12 | z=strlen(st);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | #include <string>
|
s730079751
|
p00017
|
C++
|
#include <stdio.h>
using namespace std;
int main() {
char st[80];
string w[3]={"the","this","that"};
int wn[3]={3,4,4},k,i,j,s,f,z;
while(true) {
k=0; z=0;
scanf("%[^0]",st);
z=strlen(st);
cout << z << endl;
while(k<z) {
for (i=0;i<3;i++) {
s=0; f=0;
if (z<k+wn[i]) break;
for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
if (s==wn[i]-1 && (st[k+wn[i]]<'a' || st[k+wn[i]]>'z' )) { f=1; i=5;}
}
if (f==1) break;
for (k;st[k]>='a' && st[k]<='z';k++);
k++;
}
if (f==0) cout << st; else {
for (i=0;i<z;i++) if ((st[i]>='a' && st[i]<='z')) cout << (char)(st[i]-(st[k]-'t')) ; else cout << st[i];
}
cout << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:5:9: error: 'string' was not declared in this scope
5 | string w[3]={"the","this","that"};
| ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
1 | #include <stdio.h>
+++ |+#include <string>
2 | using namespace std;
a.cc:10:11: error: 'strlen' was not declared in this scope
10 | z=strlen(st);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <stdio.h>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:11:9: error: 'cout' was not declared in this scope
11 | cout << z << endl;
| ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <stdio.h>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:11:22: error: 'endl' was not declared in this scope
11 | cout << z << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <stdio.h>
+++ |+#include <ostream>
2 | using namespace std;
a.cc:16:54: error: 'w' was not declared in this scope
16 | for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
| ^
|
s962145077
|
p00017
|
C++
|
#include <string.h>
#include <string>
#include <stdio.h>
using namespace std;
int main() {
string w[3]={"the","this","that"},st;
int wn[3]={3,4,4},k,i,j,s,f;
while(true) {
k=0;
getline(cin,st);
while(k<st.size()) {
for (i=0;i<3;i++) {
s=0; f=0;
if (st.size()<k+wn[i]) break;
for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
if (s==wn[i]-1) { f=1; i=5;}
}
if (f==1) break;
for (k;st[k]>='a' && st[k]<='z';k++);
k++;
}
if (f==0) cout << st; else {
for (i=0;i<st.size();i++)
if ((st[i]>='a' && st[i]<='z')) cout << (char)(((st[i]-st[k]+'t')-97+26) % 26 + 97) ;
else cout << st[i];
}
cout << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:10:17: error: 'cin' was not declared in this scope
10 | getline(cin,st);
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include <string>
+++ |+#include <iostream>
3 | #include <stdio.h>
a.cc:22:19: error: 'cout' was not declared in this scope
22 | if (f==0) cout << st; else {
| ^~~~
a.cc:22:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:57: error: 'cout' was not declared in this scope
24 | if ((st[i]>='a' && st[i]<='z')) cout << (char)(((st[i]-st[k]+'t')-97+26) % 26 + 97) ;
| ^~~~
a.cc:24:57: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:26: error: 'cout' was not declared in this scope
25 | else cout << st[i];
| ^~~~
a.cc:25:26: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:9: error: 'cout' was not declared in this scope
27 | cout << endl;
| ^~~~
a.cc:27:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:17: error: 'endl' was not declared in this scope
27 | cout << endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include <string>
+++ |+#include <ostream>
3 | #include <stdio.h>
|
s017143082
|
p00017
|
C++
|
#include <stdio.h>
using namespace std;
int main() {
string w[3]={"the","this","that"},st;
int wn[3]={3,4,4},k,i,j,s,f;
while(true) {
k=0;
getline(cin,st);
while(k<st.size()) {
for (i=0;i<3;i++) {
s=0; f=0;
if (st.size()<k+wn[i]) break;
for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
if (s==wn[i]-1) { f=1; i=5;}
}
if (f==1) break;
for (k;st[k]>='a' && st[k]<='z' && k<80; k++);
k++;
}
if (f==0) cout << st; else {
for (i=0;i<st.size();i++)
if ((st[i]>='a' && st[i]<='z')) cout << (char)(((st[i]-st[k]+'t')-97+26) % 26 + 97) ;
else cout << st[i];
}
cout << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:4:9: error: 'string' was not declared in this scope
4 | string w[3]={"the","this","that"},st;
| ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
1 | #include <stdio.h>
+++ |+#include <string>
2 | using namespace std;
a.cc:4:42: error: expected primary-expression before ',' token
4 | string w[3]={"the","this","that"},st;
| ^
a.cc:4:43: error: 'st' was not declared in this scope; did you mean 'std'?
4 | string w[3]={"the","this","that"},st;
| ^~
| std
a.cc:8:17: error: 'cin' was not declared in this scope
8 | getline(cin,st);
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <stdio.h>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:13:54: error: 'w' was not declared in this scope
13 | for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
| ^
a.cc:20:19: error: 'cout' was not declared in this scope
20 | if (f==0) cout << st; else {
| ^~~~
a.cc:20:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:22:57: error: 'cout' was not declared in this scope
22 | if ((st[i]>='a' && st[i]<='z')) cout << (char)(((st[i]-st[k]+'t')-97+26) % 26 + 97) ;
| ^~~~
a.cc:22:57: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:26: error: 'cout' was not declared in this scope
23 | else cout << st[i];
| ^~~~
a.cc:23:26: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:9: error: 'cout' was not declared in this scope
25 | cout << endl;
| ^~~~
a.cc:25:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:17: error: 'endl' was not declared in this scope
25 | cout << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <stdio.h>
+++ |+#include <ostream>
2 | using namespace std;
|
s906529718
|
p00017
|
C++
|
#include <stdio.h>
using namespace std;
int main() {
string w[3]={"the","this","that"},st;
int wn[3]={3,4,4},k,i,j,s,f;
while(getline(cin,st)) {
k=0;
while(k<st.size()) {
for (i=0;i<3;i++) {
s=0; f=0;
if (st.size()<k+wn[i]) break;
for (j=0;j<wn[i]-1;j++) if (((w[i][j]-w[i][j+1]+26) % 26)==((st[k+j]-st[k+j+1]+26) % 26)) s++;
if (s==wn[i]-1) { f=1; i=5;}
}
if (f==1) break;
for (k;st[k]>='a' && st[k]<='z' ; k++);
k++;
}
if (f==0) cout << st; else {
for (i=0;i<st.size();i++)
if ((st[i]>='a' && st[i]<='z')) cout << (char)(((st[i]-st[k]+'t')-97+26) % 26 + 97) ;
else cout << st[i];
}
cout << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:4:9: error: 'string' was not declared in this scope
4 | string w[3]={"the","this","that"},st;
| ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
1 | #include <stdio.h>
+++ |+#include <string>
2 | using namespace std;
a.cc:4:42: error: expected primary-expression before ',' token
4 | string w[3]={"the","this","that"},st;
| ^
a.cc:4:43: error: 'st' was not declared in this scope; did you mean 'std'?
4 | string w[3]={"the","this","that"},st;
| ^~
| std
a.cc:6:23: error: 'cin' was not declared in this scope
6 | while(getline(cin,st)) {
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <stdio.h>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:12:55: error: 'w' was not declared in this scope
12 | for (j=0;j<wn[i]-1;j++) if (((w[i][j]-w[i][j+1]+26) % 26)==((st[k+j]-st[k+j+1]+26) % 26)) s++;
| ^
a.cc:19:19: error: 'cout' was not declared in this scope
19 | if (f==0) cout << st; else {
| ^~~~
a.cc:19:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:57: error: 'cout' was not declared in this scope
21 | if ((st[i]>='a' && st[i]<='z')) cout << (char)(((st[i]-st[k]+'t')-97+26) % 26 + 97) ;
| ^~~~
a.cc:21:57: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:22:26: error: 'cout' was not declared in this scope
22 | else cout << st[i];
| ^~~~
a.cc:22:26: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:9: error: 'cout' was not declared in this scope
24 | cout << endl;
| ^~~~
a.cc:24:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:17: error: 'endl' was not declared in this scope
24 | cout << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <stdio.h>
+++ |+#include <ostream>
2 | using namespace std;
|
s900478870
|
p00017
|
C++
|
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
using namespace std;
int main(){
string str;
char s[256];
getline(cin , str);
int n = str.size();
int w = 1;
for(int i=0;i<=n;i++){
s[i] = str[i];
}
while(1){
for(int i=0;i<n;i++){
if(s[i] != ' ' && s[i] != '.'){
s[i]++;
if(s[i]>'z')s[i] = s[i] - 'z' + 'a' - 1;
}
}
if(strstr(s,"the") != NULL)break;
if(strstr(s,"that") != NULL)break;
if(strstr(s,"this") != NULL)break;
}
printf("%s\n",s);
}
|
a.cc: In function 'int main()':
a.cc:23:8: error: 'strstr' was not declared in this scope
23 | if(strstr(s,"the") != NULL)break;
| ^~~~~~
a.cc:5:1: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<cstdio>
+++ |+#include <cstring>
5 | using namespace std;
a.cc:24:8: error: 'strstr' was not declared in this scope
24 | if(strstr(s,"that") != NULL)break;
| ^~~~~~
a.cc:24:8: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:25:8: error: 'strstr' was not declared in this scope
25 | if(strstr(s,"this") != NULL)break;
| ^~~~~~
a.cc:25:8: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s620381564
|
p00017
|
C++
|
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
string str;
char s[256];
int w = 0;
while(scanf(" %c",&s[0]) != EOF{
do {
w++;
scanf("%c",&s[w]);
}while(s[w] != '\n');
while(1){
s[w+1] = '\0';
for(int i=0;i<w;i++){
if(s[i] != ' ' && s[i] != '.'){
s[i]++;
if(s[i]>'z')s[i] = s[i] - 'z' + 'a' - 1;
}
}
if(strstr(s,"the") != NULL)break;
if(strstr(s,"that") != NULL)break;
if(strstr(s,"this") != NULL)break;
}
printf("%s",s);
memset( s , 0 , sizeof(s) );
}
}
|
a.cc: In function 'int main()':
a.cc:11:34: error: expected ')' before '{' token
11 | while(scanf(" %c",&s[0]) != EOF{
| ~ ^
|
s651477975
|
p00017
|
C++
|
#include <stdio.h>
#include <stdlib.h>
#include <string>
int caesar(char s[]);
bool search(char s[]);
int main(){
char s[256];
int i,j=0,n=10;
scanf("%[^\n]",&s);
while(!search(s)){
for(i=0;s[i]!='.';i++){
if(s[i]!=' ') s[i]++;
if(s[i]>122) s[i]=97;
}
}
printf("%s\n",s);
return 0;
}
bool search(char s[]){
char *is,*e,*at;
char *tmp;
is="this";e="the";at="that";
tmp = strchr(s,is[0]);
if(tmp==NULL) return false;
while(tmp[0]!=NULL){
if(!strncmp(tmp,is,4)) return true;
if(!strncmp(tmp,e,4)) return true;
if(!strncmp(tmp,at,3)) return true;
tmp++;
}
return false;
}
|
a.cc: In function 'bool search(char*)':
a.cc:24:12: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
24 | is="this";e="the";at="that";
| ^~~~~~
a.cc:24:21: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
24 | is="this";e="the";at="that";
| ^~~~~
a.cc:24:30: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
24 | is="this";e="the";at="that";
| ^~~~~~
a.cc:25:15: error: 'strchr' was not declared in this scope
25 | tmp = strchr(s,is[0]);
| ^~~~~~
a.cc:4:1: note: 'strchr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <string>
+++ |+#include <cstring>
4 | int caesar(char s[]);
a.cc:27:23: warning: NULL used in arithmetic [-Wpointer-arith]
27 | while(tmp[0]!=NULL){
| ^~~~
a.cc:28:21: error: 'strncmp' was not declared in this scope
28 | if(!strncmp(tmp,is,4)) return true;
| ^~~~~~~
a.cc:28:21: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:29:21: error: 'strncmp' was not declared in this scope
29 | if(!strncmp(tmp,e,4)) return true;
| ^~~~~~~
a.cc:29:21: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:30:21: error: 'strncmp' was not declared in this scope
30 | if(!strncmp(tmp,at,3)) return true;
| ^~~~~~~
a.cc:30:21: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s914978560
|
p00017
|
C++
|
#include <iostream>
#include <string>
using namespace std;
bool decision(string input){
for(int i = 0; i < input.size()-3; i++){
if((input[i] == 't' && input[i+1] == 'h' && input[i+2] == 'e') ||
(input[i] == 't' && input[i+1] == 'h' && input[i+2] == 'i' && input[i+3] == 's') ||
(input[i] == 't' && input[i+1] == 'h' && input[i+2] == 'a' && input[i+3] == 't')){
return true;
}
}
return false;
}
int main(){
string input;
getline(cin, input);
while(getline(cin, input);){
for(int i = 0; i < input.size(); i++){
if('a' <= input[i] && input[i] <= 'z'){
if(input[i] != 'z'){
input[i] += 1;
}else{
input[i] = 'a';
}
}
}
if(decision(input)) cout << input << endl;;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:21:34: error: expected ')' before ';' token
21 | while(getline(cin, input);){
| ~ ^
| )
a.cc:21:35: error: expected primary-expression before ')' token
21 | while(getline(cin, input);){
| ^
|
s411728079
|
p00017
|
C++
|
#include <iostream>
#include <string>
using namespace std;
bool decision(string input){
for(int i = 0; i < input.size()-3; i++){
if((input[i] == 't' && input[i+1] == 'h' && input[i+2] == 'e') ||
(input[i] == 't' && input[i+1] == 'h' && input[i+2] == 'i' && input[i+3] == 's') ||
(input[i] == 't' && input[i+1] == 'h' && input[i+2] == 'a' && input[i+3] == 't')){
return true;
}
}
return false;
}
int main(){
string input;
getline(cin, input);
while(getline(cin, input);){
for(int i = 0; i < input.size(); i++){
if('a' <= input[i] && input[i] <= 'z'){
if(input[i] != 'z'){
input[i] += 1;
}else{
input[i] = 'a';
}
}
}
if(decision(input)) cout << input << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:21:34: error: expected ')' before ';' token
21 | while(getline(cin, input);){
| ~ ^
| )
a.cc:21:35: error: expected primary-expression before ')' token
21 | while(getline(cin, input);){
| ^
|
s915628101
|
p00017
|
C++
|
#include <iostream>
#include <string>
#include <string.h>
using namespace std;
int main(){
string alpha = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
string str;
while( cin >> str, str ){
getline( cin, str );
for( int a = 0; a < 26; a++ ){
for( int i = 0; i < str.length(); i++ ){
for( int j = 0; j < alpha.length(); j++ ){
if( str[i] == alpha[j] ){
str[i] = alpha[j + 1];
break;
}
}
}
/*char word = strtok( str.c_str(), " " );
if( word == "the" || word == "that" || word == "this" ) break;
while( word == NULL ){
word = strtok( NULL, ' ' );
if( word == "the" || word == "that" || word == "this" ) goto end;
}*/
if( str.find("the") != string::npos || str.find("this") != string::npos || str.find("that") != string::npos ){
break;
}
}
cout << str << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:8:26: error: could not convert '(((void)std::operator>><char, char_traits<char>, allocator<char> >(std::cin, str)), str)' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
8 | while( cin >> str, str ){
| ~~~~~~~~~~^~~~~
| |
| std::string {aka std::__cxx11::basic_string<char>}
|
s447265205
|
p00017
|
C++
|
/*0017 written by iPhone*/
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main(){
string s;
while(getline(cin, s), s){
for(int i = 0; i < s.size(); i++) s[i]++;
if(strstr(s.c_str(), "the") || strstr(s.c_str(), "this") || strstr(s.c_str(), "that") ) cout << s, return 0;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:10:26: error: could not convert '(((void)std::getline<char, char_traits<char>, allocator<char> >(std::cin, s)), s)' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
10 | while(getline(cin, s), s){
| ~~~~~~~~~~~~~~~^~~
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:12:108: error: expected primary-expression before 'return'
12 | if(strstr(s.c_str(), "the") || strstr(s.c_str(), "this") || strstr(s.c_str(), "that") ) cout << s, return 0;
| ^~~~~~
|
s160183139
|
p00017
|
C++
|
/*0017 written by iPhone*/
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main(){
string s;
while(getline(cin, s)){
for(int i = 0; i < s.size(); i++) s[i]++;
if(strstr(s.c_str(), "the") || strstr(s.c_str(), "this") || strstr(s.c_str(), "that") ) cout << s, return 0;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:108: error: expected primary-expression before 'return'
12 | if(strstr(s.c_str(), "the") || strstr(s.c_str(), "this") || strstr(s.c_str(), "that") ) cout << s, return 0;
| ^~~~~~
|
s497426722
|
p00017
|
C++
|
/*0017 written by iPhone*/
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main(){
string s;
while(getline(cin, s) && s){
for(int i = 0; i < s.size(); i++) s[i]++;
if(strstr(s.c_str(), "the") || strstr(s.c_str(), "this") || strstr(s.c_str(), "that") ){
cout << s;
return 0;
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:10:27: error: no match for 'operator&&' (operand types are 'std::basic_istream<char>' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
10 | while(getline(cin, s) && s){
| ~~~~~~~~~~~~~~~ ^~ ~
| | |
| | std::string {aka std::__cxx11::basic_string<char>}
| std::basic_istream<char>
a.cc:10:27: note: candidate: 'operator&&(bool, bool)' (built-in)
10 | while(getline(cin, s) && s){
| ~~~~~~~~~~~~~~~~^~~~
a.cc:10:27: note: no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
|
s041246417
|
p00017
|
C++
|
/*0017 written by iPhone*/
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main(){
string s;
while(getline(cin, s) && s != "\0"){
for(int i = 0; i < s.size(); i++) s[i]++;
if(strstr(s.c_str(), "the") != NULL || strstr(s.c_str(), "this") = NULL || strstr(s.c_str(), "that") != NULL ){
cout << s;
return 0;
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:45: error: lvalue required as left operand of assignment
12 | if(strstr(s.c_str(), "the") != NULL || strstr(s.c_str(), "this") = NULL || strstr(s.c_str(), "that") != NULL ){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s329472755
|
p00017
|
C++
|
/*0017 written by iPhone*/
#include <iostream>
#include <string>
using namespace std;
int main(){
string s;
while(getline(cin, s) && s != "\0"){
for(int i = 0; i < s.size(); i++) {
if(s[i] != " ") s[i]++;
if(s[i] > 'z' && s[i] != " ") s[i] -= 'z' - 'a';
}
if(s.find("the") != -1 || s.find("this") != -1 || s.find("that") != -1 ){
cout << s;
return 0;
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
11 | if(s[i] != " ") s[i]++;
a.cc:12:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
12 | if(s[i] > 'z' && s[i] != " ") s[i] -= 'z' - 'a';
|
s620618716
|
p00017
|
C++
|
using namespace std;
int main(){
char str;
while(1){
str = getchar();
if(str=='.'){
cout<<str;
break;
}
if(str!=' '){
str=str-4;
cout<<str;
}else{
cout<<" ";
}
}
cout<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:6:11: error: 'getchar' was not declared in this scope
6 | str = getchar();
| ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 |
a.cc:8:7: error: 'cout' was not declared in this scope
8 | cout<<str;
| ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 |
a.cc:13:7: error: 'cout' was not declared in this scope
13 | cout<<str;
| ^~~~
a.cc:13:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:7: error: 'cout' was not declared in this scope
15 | cout<<" ";
| ^~~~
a.cc:15:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:3: error: 'cout' was not declared in this scope
18 | cout<<endl;
| ^~~~
a.cc:18:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:9: error: 'endl' was not declared in this scope
18 | cout<<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 |
|
s871409744
|
p00017
|
C++
|
#include<iostream>
#include<string>
int main(){
std::string str;
while(std::getline(std::cin,str)){
for(int i=0;i<str.size();i++){
if(str[i]!=' ')str[i]+=1;
}
std::cout<<str<<std::endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:2: error: expected '}' at end of input
11 | }
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s963370908
|
p00017
|
C++
|
#include <iostream>
#include <stdio.h>
#include <string>
#include <queue>
#include <cmath>
#include <stack>
#define int64 long long int
using namespace std;
char * caesar(char *);
int main()
{
int i, c;
char str[128];
while(1){
for(i=0; ; i++){
c = getchar();
if(c == '\n' || c == EOF) break;
str[i] = c;
}
str[i] = 0;
cout << caesar(str) << '\n';
if(c == EOF) break;
}
return 0;
}
char * caesar(char *str){
int len, i;
len = strlen(str);
while(1){
for(i=0; i<len; i++){
if(str[i] >= 'b' && str[i] <= 'z')
str[i]--;
else if(str[i] == 'a')
str[i] = 'z';
}
for(i=0; i<len; i++){
if(str[i] == 't' && str[i+1] == 'h'){
if(str[i+2] == 'e' ||
(str[i+2] == 'i' && str[i+3] == 's') ||
(str[i+2] == 'a' && str[i+3] == 't'))
return str;
}
}
}
return 0;
}
|
a.cc: In function 'char* caesar(char*)':
a.cc:36:15: error: 'strlen' was not declared in this scope
36 | len = strlen(str);
| ^~~~~~
a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include <stack>
+++ |+#include <cstring>
7 |
|
s707869437
|
p00017
|
C++
|
#include <iostream>
#include <string>
using namespace std;
int main() {
string str;
string in;
vector<string> s;
while (cin >> in) s.push_back(in);
for (int i=0; i<(int)s.size(); i++) {
str += s[i];
if (i<(int)s.size()-1) str += " ";
}
for (int i=1; i<=26; i++) {
for (int j=0; j<n; j++) {
if (str[j] == '.') continue;
str[j] = str[j] + i;
if (str[j] > 'z') str[j] = 'a' + str[j] - 'z';
}
if (str.find("the")!=str.npos || str.find("this")!=str.npos || str.find("that")!=str.npos) break;
}
cout << str << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:9: error: 'vector' was not declared in this scope
9 | vector<string> s;
| ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
1 | #include <iostream>
+++ |+#include <vector>
2 | #include <string>
a.cc:9:22: error: expected primary-expression before '>' token
9 | vector<string> s;
| ^
a.cc:9:24: error: 's' was not declared in this scope
9 | vector<string> s;
| ^
a.cc:17:33: error: 'n' was not declared in this scope
17 | for (int j=0; j<n; j++) {
| ^
|
s540982922
|
p00017
|
C++
|
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
using namespace string;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int gcd(int a, int b){
int tmp;
while(a%b==0){
tmp=a%b;
a=b;
b=tmp;
}
}
int lcm(int a,int b){
return a*b/gcd(a,b);
}
bool prime_number(int n){
if(n < 2){
return false;
}
else if(n == 2){
return true;
}
if(n % 2 == 0){
return false;
}
for(int i=3;i<=n/i;i+=2){
if(n % i == 0) return false;
return true;
}
}
int main(){
string a;
while(getline(cin,a)){
while(a.find("the")==npos&&a.find("this")==npos&&str.find("that")==npos)
REP(i,a.size()){
if(a[i]=='z') a[i]=='a';
else if(a[i]>=a&&a[i]<='z') a[i]++;
}
cout << a << endl;
}
return 0;
}
|
a.cc:28:17: error: 'string' is not a namespace-name
28 | using namespace string;
| ^~~~~~
a.cc: In function 'int gcd(int, int)':
a.cc:82:1: warning: no return statement in function returning non-void [-Wreturn-type]
82 | }
| ^
a.cc: In function 'int main()':
a.cc:108:28: error: 'npos' was not declared in this scope
108 | while(a.find("the")==npos&&a.find("this")==npos&&str.find("that")==npos)
| ^~~~
a.cc:108:56: error: 'str' was not declared in this scope; did you mean 'std'?
108 | while(a.find("the")==npos&&a.find("this")==npos&&str.find("that")==npos)
| ^~~
| std
a.cc:111:25: error: no match for 'operator>=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/vector:62,
from a.cc:3:
/usr/include/c++/14/bits/stl_pair.h:1070:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1070 | operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1070:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:476:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
476 | operator>=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:476:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
/usr/include/c++/14/bits/stl_iterator.h:520:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
520 | operator>=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:520:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1724:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1724 | operator>=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1724:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1781:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1781 | operator>=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1781:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:2114:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2114 | operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2114:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::vector<_Tp, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/vector:87:
/usr/include/c++/14/tuple:2631:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2631 | operator>=(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2631:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::tuple<_UTypes ...>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/list:65,
from a.cc:4:
/usr/include/c++/14/bits/stl_list.h:2217:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const __cxx11::list<_Tp, _Alloc>&, const __cxx11::list<_Tp, _Alloc>&)'
2217 | operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_list.h:2217:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::__cxx11::list<_Tp, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:5:
/usr/include/c++/14/bits/stl_map.h:1578:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator>=(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
1578 | operator>=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1578:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::map<_Key, _Tp, _Compare, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/map:64:
/usr/include/c++/14/bits/stl_multimap.h:1200:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>&, const multimap<_Key, _Tp, _Compare, _Allocator>&)'
1200 | operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multimap.h:1200:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::multimap<_Key, _Tp, _Compare, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/set:63,
from a.cc:6:
/usr/include/c++/14/bits/stl_set.h:1053:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator>=(const set<_Key, _Compare, _Allocator>&, const set<_Key, _Compare, _Allocator>&)'
1053 | operator>=(const set<_Key, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_set.h:1053:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::set<_Key, _Compare, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/set:64:
/usr/include/c++/14/bits/stl_multiset.h:1039:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator>=(const multiset<_Key, _Compare, _Allocator>&, const multiset<_Key, _Compare, _Allocator>&)'
1039 | operator>=(const multiset<_Key, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:1039:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::multiset<_Key, _Compare, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/deque:66,
from a.cc:7:
/usr/include/c++/14/bits/stl_deque.h:2363:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2363 | operator>=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2363:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::deque<_Tp, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 |
|
s075285358
|
p00017
|
C++
|
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
using namespace string;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int gcd(int a, int b){
int tmp;
while(a%b==0){
tmp=a%b;
a=b;
b=tmp;
}
}
int lcm(int a,int b){
return a*b/gcd(a,b);
}
bool prime_number(int n){
if(n < 2){
return false;
}
else if(n == 2){
return true;
}
if(n % 2 == 0){
return false;
}
for(int i=3;i<=n/i;i+=2){
if(n % i == 0) return false;
return true;
}
}
int main(){
string a;
while(getline(cin,a)){
while(a.find("the")==npos&&a.find("this")==npos&&str.find("that")==npos)
REP(i,a.size()){
if(a[i]=='z') a[i]=='a';
else if(a[i]>=a&&a[i]<='z') a[i]++;
}
cout << a << endl;
}
return 0;
}
|
a.cc:28:17: error: 'string' is not a namespace-name
28 | using namespace string;
| ^~~~~~
a.cc: In function 'int gcd(int, int)':
a.cc:82:1: warning: no return statement in function returning non-void [-Wreturn-type]
82 | }
| ^
a.cc: In function 'int main()':
a.cc:108:28: error: 'npos' was not declared in this scope
108 | while(a.find("the")==npos&&a.find("this")==npos&&str.find("that")==npos)
| ^~~~
a.cc:108:56: error: 'str' was not declared in this scope; did you mean 'std'?
108 | while(a.find("the")==npos&&a.find("this")==npos&&str.find("that")==npos)
| ^~~
| std
a.cc:111:25: error: no match for 'operator>=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/vector:62,
from a.cc:3:
/usr/include/c++/14/bits/stl_pair.h:1070:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1070 | operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1070:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:476:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
476 | operator>=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:476:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
/usr/include/c++/14/bits/stl_iterator.h:520:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
520 | operator>=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:520:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1724:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1724 | operator>=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1724:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1781:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1781 | operator>=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1781:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:2114:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2114 | operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2114:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::vector<_Tp, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/vector:87:
/usr/include/c++/14/tuple:2631:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2631 | operator>=(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2631:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::tuple<_UTypes ...>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/list:65,
from a.cc:4:
/usr/include/c++/14/bits/stl_list.h:2217:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const __cxx11::list<_Tp, _Alloc>&, const __cxx11::list<_Tp, _Alloc>&)'
2217 | operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_list.h:2217:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::__cxx11::list<_Tp, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:5:
/usr/include/c++/14/bits/stl_map.h:1578:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator>=(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
1578 | operator>=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1578:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::map<_Key, _Tp, _Compare, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/map:64:
/usr/include/c++/14/bits/stl_multimap.h:1200:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>&, const multimap<_Key, _Tp, _Compare, _Allocator>&)'
1200 | operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multimap.h:1200:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::multimap<_Key, _Tp, _Compare, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/set:63,
from a.cc:6:
/usr/include/c++/14/bits/stl_set.h:1053:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator>=(const set<_Key, _Compare, _Allocator>&, const set<_Key, _Compare, _Allocator>&)'
1053 | operator>=(const set<_Key, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_set.h:1053:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::set<_Key, _Compare, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/set:64:
/usr/include/c++/14/bits/stl_multiset.h:1039:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator>=(const multiset<_Key, _Compare, _Allocator>&, const multiset<_Key, _Compare, _Allocator>&)'
1039 | operator>=(const multiset<_Key, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:1039:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::multiset<_Key, _Compare, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 | else if(a[i]>=a&&a[i]<='z') a[i]++;
| ^
In file included from /usr/include/c++/14/deque:66,
from a.cc:7:
/usr/include/c++/14/bits/stl_deque.h:2363:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2363 | operator>=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2363:5: note: template argument deduction/substitution failed:
a.cc:111:27: note: mismatched types 'const std::deque<_Tp, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
111 |
|
s392210541
|
p00018
|
Java
|
import java.io.*;
import java.util.*;
class Main{
public static void main(String[] args){
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str;
int[] n=new int[5];
while((str=br.readLine())!=null){
String[] s=str.split(" ");
for(int i=0;i<5;i++){
n[i]=Integer.parseInt(s[i]);
}
Arrays.sort(n);
for(int i=5;i>0;i--){
System.out.println(n[i-1]);
}
}
}
}
|
Main.java:9: error: unreported exception IOException; must be caught or declared to be thrown
while((str=br.readLine())!=null){
^
1 error
|
s525090996
|
p00018
|
Java
|
rt java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a[] =new int[5];
for (int i =0;i<a.length;i++){
a[i] = sc.nextInt();
}
Arrays.sort(a);
System.out.println(a[4]+" "+a[3]+" "+a[2]+" "+a[1]+" "+a[0]);
}
}
|
Main.java:1: error: class, interface, enum, or record expected
rt java.util.*;
^
1 error
|
s170758699
|
p00018
|
Java
|
import java.util.Arrays;
import java.util.Scanner;
class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] n = new int[5];
for(int i = 0; i < 5; i++){
n[i]= sc.nextInt();
}
Arrays.sort(n);
System.out.println(n[4]+" "+n[3]+" "+n[2]+" "+n[1]+" "+n[0]);
|
Main.java:12: error: reached end of file while parsing
System.out.println(n[4]+" "+n[3]+" "+n[2]+" "+n[1]+" "+n[0]);
^
1 error
|
s640102331
|
p00018
|
Java
|
import java.util.*;
public class Sort {
/**
* @param args
*/
public static void main(String[] args) {
// TODO ?????????????????????????????????????????????
Scanner sc = new Scanner(System.in);
int a[] = new int[5];
for(int i = 0; i<5; i++){
a[i]=sc.nextInt();
}
Arrays.sort(a);
for(int i = 4; i>-1;i--){
System.out.println(a[i]);
}
}
}
|
Main.java:2: error: class Sort is public, should be declared in a file named Sort.java
public class Sort {
^
1 error
|
s578194806
|
p00018
|
Java
|
import java.util.*;
public class Sort {
/**
* @param args
*/
public static void main(String[] args) {
// TODO ?????????????????????????????????????????????
Scanner sc = new Scanner(System.in);
int a[] = new int[5];
for(int i = 0; i<5; i++){
a[i]=sc.nextInt();
}
Arrays.sort(a);
for(int i = 4; i>0;i--){
System.out.print(a[i]);
}
System.out.print(a[0]);
}
}
|
Main.java:2: error: class Sort is public, should be declared in a file named Sort.java
public class Sort {
^
1 error
|
s514420877
|
p00018
|
Java
|
import java.util.*;
public class Sort {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a[] = new int[5];
for(int i = 0; i<5; i++){
a[i]=sc.nextInt();
}
Arrays.sort(a);
System.out.print(a[4]+" "+a[3]+" "+a[2]+" "+a[1]+" "+a[0]);
}
}
|
Main.java:2: error: class Sort is public, should be declared in a file named Sort.java
public class Sort {
^
1 error
|
s866577866
|
p00018
|
Java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class Main {
public static void main(String[] args) throws IOException {
List<Integer> values = new ArrayList<Integer>();
String s = new BufferedReader(new InputStreamReader(System.in)).readLine();
String outString = "";
String[] sarr = s.split(" ");
int len = sarr.length;
for(int i =0; i < len; i++){
values.add(Integer.valueOf(sarr[i]));
}
Collections.sort(values);
System.out.println(String.join(" ",values));
}
}
|
Main.java:24: error: no suitable method found for join(String,List<Integer>)
System.out.println(String.join(" ",values));
^
method String.join(CharSequence,CharSequence...) is not applicable
(varargs mismatch; List<Integer> cannot be converted to CharSequence)
method String.join(CharSequence,Iterable<? extends CharSequence>) is not applicable
(argument mismatch; List<Integer> cannot be converted to Iterable<? extends CharSequence>)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
|
s412437748
|
p00018
|
Java
|
import java.util.Scanner;
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int oldArray[] = new int[5];
int t;
for (int i=0; i<5; i++) {
int a = scan.nextInt();
oldArray[i] = a;
}
for (int j=0; j<4; j++){
for (int m=0; m<4-j;m++)
if (oldArray[m]<oldArray[m+1]){
t = oldArray[m];
oldArray[m] = oldArray[m+1];
oldArray[m+1] = t;
}
}
String delim = "";
StringBuilder oo = new StringBuilder();
for (int i=0; i<5; i++) {
oo.append(delim).append(oldArray[i]);
delim = " ";
}
System.out.println(oo);
}
|
Main.java:2: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args)
^
(use --enable-preview to enable unnamed classes)
1 error
|
s188171234
|
p00018
|
Java
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class SortingFiveNumbers {
public static void main(String[] a){
int inputCount = 5;
Scanner in = new Scanner(System.in);
String input = in.nextLine();
String[] numArray = input.split(" ");
if (numArray.length == inputCount){
ArrayList <Integer> output = new ArrayList<Integer>();
for (String s : numArray){
//convert to ArrayList<Integer>
output.add(Integer.parseInt(s)); // to check if a number
}
Collections.sort(output);
String outputSeq = "";
for (Integer i: output){
outputSeq = i + " " + outputSeq;
}
System.out.println(outputSeq);
} else {
}
}
}
|
Main.java:6: error: class SortingFiveNumbers is public, should be declared in a file named SortingFiveNumbers.java
public class SortingFiveNumbers {
^
1 error
|
s635999571
|
p00018
|
Java
|
import java.util.Arrays;
import java.util.Scanner;
public class SortingFiveNumbers {
public static void main(String[] a){
int inputCount = 5;
Scanner in = new Scanner(System.in);
String input = in.nextLine();
String[] numArray = input.split(" ");
int[] temp = new int [inputCount];
for (int i=0; i<inputCount; i++){
temp[i] = Integer.parseInt(numArray[i]);
}
Arrays.sort(temp);
System.out.println(temp[4] + " " +
temp[3] + " " +
temp[2] + " " +
temp[1] + " " +
temp[0]);
}
}
|
Main.java:5: error: class SortingFiveNumbers is public, should be declared in a file named SortingFiveNumbers.java
public class SortingFiveNumbers {
^
1 error
|
s838267589
|
p00018
|
Java
|
import java.io.*;
import java.util.*;
public class InsertionSort
{
public static void main(String args[])
{
int[] arr=new int[1000];
Scanner inp=new Scanner(System.in);
int n=5;
int i;
for(i=0; i<n; i++)
{
arr[i]=inp.nextInt();
}
Sortthis sorted=new Sortthis();
sorted.sorting(arr, n);
for(i=0; i<n; i++)
System.out.print(arr[i]+" ");
}
}
class Sortthis
{
public void sorting(int[] arr, int n)
{
int i, j;
for(i=1; i<n; i++)
{
j=i;
while(j>0 && (arr[j]>arr[j-1]))
{
int temp=arr[j];
arr[j]=arr[j-1];
arr[j-1]=temp;
j=j-1;
}
}
}
}
|
Main.java:4: error: class InsertionSort is public, should be declared in a file named InsertionSort.java
public class InsertionSort
^
1 error
|
s605968996
|
p00018
|
Java
|
import java.util.Scanner;
class ?????????{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
long a;
long b;
long c;
long d;
long e;
int median;
long num[]=new long[6];
a=sc.nextInt();
b=sc.nextInt();
c=sc.nextInt();
d=sc.nextInt();
e=sc.nextInt();
num[0]=a;
num[1]=b;
num[2]=c;
num[3]=d;
num[4]=e;
num[5]=e;
for(int i=0;i<5;i++){
for(int j=1;j<i-1;j++){
if(num[i]<num[j]){
int taihi;
num[5] = num[j];
num[j]=num[i];
num[i]=num[5];
}
}
}
System.out.println(num[4]+" "+num[3]+" "+num[2]+" "+num[1]+" "+num[0]);
}
}
|
Main.java:2: error: <identifier> expected
class ?????????{
^
1 error
|
s849953408
|
p00018
|
Java
|
import static java.lang.Integer.parseInt;
import static java.lang.System.out;
import static java.util.Collections.reverse;
import static java.util.Collections.sort;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import junit.framework.TestCase;
public class Main extends BaseExe {
public static void main(String[] args) {
new Main().exeSysIn();
}
@Override
protected void execute() {
List<Integer> list = revSortList();
for (int index = 0; index < list.size(); index++)
printItem(index, list);
}
private List<Integer> getList() {
String[] inDataes = nextLine().split(" ");
List<Integer> list = new ArrayList<>();
for (int index = 0; index < 5; index++)
list.add(parseInt(inDataes[index]));
return list;
}
private List<Integer> revSortList() {
List<Integer> list = getList();
sort(list);
reverse(list);
return list;
}
private void printItem(int index, List<Integer> list) {
if (index == list.size() - 1)
out.println(list.get(index));
else
out.print(list.get(index) + " ");
}
}
abstract class BaseExe extends TestCase {
/** ????????£?????? */
private Scanner scan;
/** ??\???????????? */
private String inData;
/** ?????????????????\????????? */
public void exeSysIn() {
try (Scanner scan = new Scanner(System.in)) {
exeCtrl(scan);
} catch (Exception e) {
fail(e.getMessage());
}
}
/** ??????????????\????????? */
public void exeFileIn(String inDataPath) {
try (Scanner scan = new Scanner(new File(inDataPath))) {
exeCtrl(scan);
} catch (Exception e) {
fail(e.getMessage());
}
}
/** ??????????????????????????? */
private void exeCtrl(Scanner scan) {
this.scan = scan;
execute();
}
/** ????????? */
protected abstract void execute();
/** ?¬?????????? */
protected String nextLine() {
return scan.nextLine();
}
/** ??\????????? */
protected boolean judgeInData() {
return hasNextLine() && isNotEmptyInData();
}
/** ?¬?????????¨?????? */
protected boolean hasNextLine() {
return scan.hasNextLine();
}
/** ??????????????? */
protected boolean isNotEmptyInData() {
inData = nextLine();
return !inData.isEmpty();
}
/** ??\?????????????????? */
protected String getInData() {
if (inData.isEmpty())
fail("inData is Empty.");
return inData;
}
}
|
Main.java:9: error: package junit.framework does not exist
import junit.framework.TestCase;
^
Main.java:47: error: cannot find symbol
abstract class BaseExe extends TestCase {
^
symbol: class TestCase
Main.java:60: error: cannot find symbol
fail(e.getMessage());
^
symbol: method fail(String)
location: class BaseExe
Main.java:69: error: cannot find symbol
fail(e.getMessage());
^
symbol: method fail(String)
location: class BaseExe
Main.java:106: error: cannot find symbol
fail("inData is Empty.");
^
symbol: method fail(String)
location: class BaseExe
5 errors
|
s981640119
|
p00018
|
Java
|
import static java.lang.Integer.parseInt;
import static java.lang.System.out;
import static java.util.Collections.reverse;
import static java.util.Collections.sort;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import junit.framework.TestCase;
public class Main extends BaseExe {
public static void main(String[] args) {
new Main().exeSysIn();
}
@Override
protected void execute() {
List<Integer> list = revSortList();
for (int index = 0; index < list.size(); index++)
printItem(index, list);
}
private List<Integer> getList() {
String[] inDataes = nextLine().split(" ");
List<Integer> list = new ArrayList<>();
for (int index = 0; index < 5; index++)
list.add(parseInt(inDataes[index]));
return list;
}
private List<Integer> revSortList() {
List<Integer> list = getList();
sort(list);
reverse(list);
return list;
}
private void printItem(int index, List<Integer> list) {
if (index == list.size() - 1)
out.println(list.get(index));
else
out.print(list.get(index) + " ");
}
}
abstract class BaseExe extends TestCase {
/** ????????£?????? */
private Scanner scan;
/** ??\???????????? */
private String inData;
/** ?????????????????\????????? */
public void exeSysIn() {
try (Scanner scan = new Scanner(System.in)) {
exeCtrl(scan);
} catch (Exception e) {
fail(e.getMessage());
}
}
/** ??????????????\????????? */
public void exeFileIn(String inDataPath) {
try (Scanner scan = new Scanner(new File(inDataPath))) {
exeCtrl(scan);
} catch (Exception e) {
fail(e.getMessage());
}
}
/** ??????????????????????????? */
private void exeCtrl(Scanner scan) throws Exception {
this.scan = scan;
execute();
}
/** ????????? */
protected abstract void execute() throws Exception;
/** ?¬?????????? */
protected String nextLine() {
return scan.nextLine();
}
/** ??\????????? */
protected boolean judgeInData() {
return hasNextLine() && isNotEmptyInData();
}
/** ?¬?????????¨?????? */
protected boolean hasNextLine() {
return scan.hasNextLine();
}
/** ??????????????? */
protected boolean isNotEmptyInData() {
inData = nextLine();
return !inData.isEmpty();
}
/** ??\?????????????????? */
protected String getInData() throws Exception {
if (inData.isEmpty())
throw new Exception("inData is Empty.");
return inData;
}
}
|
Main.java:9: error: package junit.framework does not exist
import junit.framework.TestCase;
^
Main.java:47: error: cannot find symbol
abstract class BaseExe extends TestCase {
^
symbol: class TestCase
Main.java:60: error: cannot find symbol
fail(e.getMessage());
^
symbol: method fail(String)
location: class BaseExe
Main.java:69: error: cannot find symbol
fail(e.getMessage());
^
symbol: method fail(String)
location: class BaseExe
4 errors
|
s227714356
|
p00018
|
Java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;
public class SortingFiveNumbers {
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int array[] = new int [5];
int a = Integer.parseInt(br.readLine());
int b = Integer.parseInt(br.readLine());
int c = Integer.parseInt(br.readLine());
int d = Integer.parseInt(br.readLine());
int e = Integer.parseInt(br.readLine());
System.out.println(Comparator.reverseOrder());
}
}
|
Main.java:7: error: class SortingFiveNumbers is public, should be declared in a file named SortingFiveNumbers.java
public class SortingFiveNumbers {
^
1 error
|
s498420519
|
p00018
|
Java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Main{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] input = br.readLine().split(" ");
List<Integer> converted = SortingFiveNumbers.convertToNumbers(input);
StringBuilder builder = new StringBuilder();
converted.stream().sorted((num1, num2) -> num2 - num1).forEach(num -> builder.append(num + " "));
System.out.println(builder.delete(builder.length() - 1, builder.length() - 1));
}
/**
* ????????????????????°????????????????????????????????????
*
* @param input
* ???????????????
* @return ??°???????????????
*/
public static List<Integer> convertToNumbers(String[] input) {
List<Integer> converted = new ArrayList<>();
for (String string : input) {
converted.add(Integer.parseInt(string));
}
return converted;
}
}
|
Main.java:15: error: cannot find symbol
List<Integer> converted = SortingFiveNumbers.convertToNumbers(input);
^
symbol: variable SortingFiveNumbers
location: class Main
1 error
|
s510751860
|
p00018
|
Java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Main{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] input = br.readLine().split(" ");
List<Integer> converted = SortingFiveNumbers.convertToNumbers(input);
StringBuilder builder = new StringBuilder();
converted.stream().sorted((num1, num2) -> num2 - num1).forEach(num -> builder.append(num + " "));
System.out.println(builder.delete(builder.length() - 1, builder.length() - 1));
}
public static List<Integer> convertToNumbers(String[] input) {
List<Integer> converted = new ArrayList<>();
for (String string : input) {
converted.add(Integer.parseInt(string));
}
return converted;
}
}
|
Main.java:15: error: cannot find symbol
List<Integer> converted = SortingFiveNumbers.convertToNumbers(input);
^
symbol: variable SortingFiveNumbers
location: class Main
1 error
|
s202348381
|
p00018
|
Java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Main{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] input = br.readLine().split(" ");
List<Integer> converted = SortingFiveNumbers.convertToNumbers(input);
StringBuilder builder = new StringBuilder();
converted.stream().sorted((num1, num2) -> num2 - num1).forEach(num -> builder.append(num + " "));
System.out.println(builder.delete(builder.length() - 1, builder.length() - 1));
}
/**
* ????????????????????°????????????????????????????????????
*
* @param input
* ???????????????
* @return ??°???????????????
*/
public static List<Integer> convertToNumbers(String[] input) {
List<Integer> converted = new ArrayList<>();
for (String string : input) {
converted.add(Integer.parseInt(string));
}
return converted;
}
}
|
Main.java:15: error: cannot find symbol
List<Integer> converted = SortingFiveNumbers.convertToNumbers(input);
^
symbol: variable SortingFiveNumbers
location: class Main
1 error
|
s988664613
|
p00018
|
Java
|
Main class for AOJ where there is no input.
*/
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
String[] arr = str.split(" ");
int[] list = new int[arr.length];
for(int i = 0; i < arr.length; i ++){
list[i] = Integer.parseInt(arr[i]);
}
Arrays.sort(list);
for(int i = arr.length - 1; i >= 0; i --){
System.out.print(arr[i]);
if(i != 0){
System.out.print(" ");
}
}
System.out.println();
}//main
}//class
|
Main.java:1: error: class, interface, enum, or record expected
Main class for AOJ where there is no input.
^
Main.java:1: error: <identifier> expected
Main class for AOJ where there is no input.
^
2 errors
|
s423977441
|
p00018
|
Java
|
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String[] inputArray = input.readLine().split(" ");
ArrayList<Integer> inputList = new ArrayList<>();
for (String each : inputArray) {
inputList.add(Integer.parseInt(each));
}
Collections.sort(inputList);
Collections.reverse(inputList);
System.out.println(inputList.get(0) + " " + inputList.get(1) + " " + inputList.get(2) + " "
+ inputList.get(3) + " " + inputList.get(4));
}
}
|
Main.java:1: error: class, interface, enum, or record expected
3
^
Main.java:22: error: class, interface, enum, or record expected
import java.io.IOException;
^
Main.java:23: error: class, interface, enum, or record expected
import java.io.InputStreamReader;
^
Main.java:24: error: class, interface, enum, or record expected
import java.util.ArrayList;
^
Main.java:25: error: class, interface, enum, or record expected
import java.util.Collections;
^
5 errors
|
s440864033
|
p00018
|
Java
|
import java.util.*;
public class Main{
Main(){
Scanner sc = new Scanner(System.in);
int[] ary = new int[5];
while(sc.hasNext()){
for(int i = 0; i < 5; i++)
ary[i] = sc.nextInt();
Arrays.sort(ary);
System.out.print(Integer.toString(ary[4]));
for(int i = 3; i >= 0; i--)
System.out.print(" " + Integer.toString(ary[i]));
System.out.println();
}
}
public static void main(String[] args){
new p0018();
}
}
|
Main.java:20: error: cannot find symbol
new p0018();
^
symbol: class p0018
location: class Main
1 error
|
s158792683
|
p00018
|
Java
|
public class Main {
public static void main(String[] args) {
try {
// Problem0018_SortingFiveNumbers test = new Problem0018_SortingFiveNumbers();
Main test = new Main();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line;
while((line = reader.readLine()) != null) {
String[] textArray = line.split(" ");
int[] numbers = new int[5];
for(int i = 0; i < numbers.length; i++) {
numbers[i] = Integer.parseInt(textArray[i]);
}
test.sort(numbers);
for(int i = 0; i < numbers.length-1; i++) {
System.out.print(numbers[i] + " ");
}
System.out.println(numbers[numbers.length-1]);
}
} catch(Exception e) {
e.printStackTrace();
}
/*
Problem0018_SortingFiveNumbers test = new Problem0018_SortingFiveNumbers();
for(int i = 0; i < 200; i++) {
int[] array = new int[5];
for(int j = 0; j < array.length; j++) {
array[j] = (int)(Math.random() * 100);
}
test.shuffle(array);
for(int number : array) {
System.out.print(number +" ");
}
System.out.println();
test.sort(array);
for(int number : array) {
System.err.print(number +" ");
}
System.err.println();
}
*/
}
void sort(int[] array) {
int[] numbers = array;
for(int i = 1; i < numbers.length; i++) {
for(int j = i; j > 0; j--) {
if(numbers[j-1] < numbers[j]) {
int temporary = numbers[j];
numbers[j] = numbers[j-1];
numbers[j-1] = temporary;
} else {
break;
}
}
}
}
void shuffle(int[] targetArray) {
int[] array = targetArray;
for(int i = 0; i < array.length; i++) {
int position = (int)(Math.random() * (i+1));
int temporary = array[position];
array[position] = array[i];
array[i] = temporary;
}
}
}
|
Main.java:6: error: cannot find symbol
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:6: error: cannot find symbol
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:6: error: cannot find symbol
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class InputStreamReader
location: class Main
3 errors
|
s246347933
|
p00018
|
Java
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args)
throws java.io.IOException{
Scanner scan = new Scanner(System.in);
int[] delta=new int[5];
for(int j=0;j<5;j++){
delta[j] = scan.nextInt();
}
Arrays.sort(delta);
System.out.print(delta[4]+" ");
System.out.print(delta[3+" "]);
System.out.print(delta[2+ " "]);
System.out.print(delta[1]+" ");
System.out.print(delta[0]);
}
}
|
Main.java:16: error: incompatible types: String cannot be converted to int
System.out.print(delta[3+" "]);
^
Main.java:17: error: incompatible types: String cannot be converted to int
System.out.print(delta[2+ " "]);
^
2 errors
|
s696258304
|
p00018
|
Java
|
import java.util.*;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner stdIn = new Scanner(System.in);
int[] a = new int[5];
for(int i=0; i<5; i++){
a[i] = stdIn.nextInt();
}
boolean jdg;
do{
jdg = true;
for(int i=0; i<4; i++){
if(a[i]<a[i+1]){
int t = a[i];
a[i] = a[i+1];
a[i+1] = t;
jdg = false;
}
}
} while(jdg == false);
for(int i : a) System.out.print(i + " ");
}
|
Main.java:31: error: reached end of file while parsing
}
^
1 error
|
s219171807
|
p00018
|
Java
|
import java.util.Arrays;
import java.util.Scanner;
public class Test {
public static void main(String args[]){
Scanner stdIn = new Scanner(System.in);
int[] intArray = new int[5];
for(int i = 0;i < intArray.length; i++){
intArray[i] = stdIn.nextInt();
}
Arrays.sort(intArray);
for(int i = intArray.length - 1;i >= 0; i--){
if(i == 0){
System.out.println(intArray[i]);
}else{
System.out.print(intArray[i] + " ");
}
}
}
}
|
Main.java:5: error: class Test is public, should be declared in a file named Test.java
public class Test {
^
1 error
|
s339770378
|
p00018
|
Java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
public class Id0018 {
public static void main(String[] args){
ArrayList<String> list;
String[] str;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
String s = br.readLine();
list = new ArrayList<String>();
str = s.split(" ");
for(int i=0; i<str.length; i++){
list.add(str[i]);
}
Collections.reverse(list);
for(String a : list){
System.out.print(a + " ");
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
Main.java:7: error: class Id0018 is public, should be declared in a file named Id0018.java
public class Id0018 {
^
1 error
|
s383959170
|
p00018
|
Java
|
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
class Main{
public static void main(String[] a){
Scanner sc = new Scanner(System.in).useDelimiter("\n");
ArrayList<String> alstr = new ArrayList<String>();
while(sc.hasNext()){
alstr.add(sc.next());
}
int[] foo = null;
String[] strarr = null;
int strlen = null;
for (String str : alstr) {
strarr = str.split(" ");
strlen = strarr.length;
foo = new int[strlen];
for (int iter = 0; iter < strlen; iter++) {
foo[iter] = Integer.parseInt(strarr[iter]);
}
Arrays.sort(foo);
for (int iter = 0; iter < strlen / 2; iter++) {
int tmp = foo[iter];
foo[iter] = foo[strlen-iter-1];
foo[strlen-iter-1] = tmp;
}
for (int iter = 0; iter < strlen; iter++) {
System.out.print(foo[iter]);
if (iter == strlen-1) System.out.println();
else System.out.print(" ");
}
}
}
}
|
Main.java:15: error: incompatible types: <null> cannot be converted to int
int strlen = null;
^
1 error
|
s034369039
|
p00018
|
Java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
public class Main {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = null;
try {
while ((line = br.readLine()) != null) {
line.trim();
String[] words = line.split("\\s");
ArrayList<Integer> num = new ArrayList<Integer>();
for(String s : words) num.add(Integer.parseInt(s));
Collections.sort(num);
Collections.reverse(num);
String str = num.toString();
str = str.replaceAll("[\\[\\],]", "");
System.out.println(str);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
Main.java:8: error: illegal character: '\u3000'
public class?Main {
^
1 error
|
s712167117
|
p00018
|
Java
|
import java.util.Arrays;
import java.util.Scanner;
public class Sort1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
String line = sc.nextLine();
Scanner s = new Scanner(line);
int[] a = new int[5];
for (int i=0 ; i<5 ; i++){
a[i] = s.nextInt(); }
Arrays.sort(a);
printReverse(a);
}
}
static void printReverse(int[] a) {
for (int i = a.length - 1; i >= 0; i--) {
System.out.print(a[i]);
if (i == 0)
break;
System.out.print(" ");
}
System.out.println();
}
}
|
Main.java:4: error: class Sort1 is public, should be declared in a file named Sort1.java
public class Sort1 {
^
1 error
|
s505982681
|
p00018
|
C
|
nclude<stdio.h>
int main(){
int a,i,j,s[5];
scanf("%d %d %d %d %d",&s[0],&s[1],&s[2],&s[3],&s[4]);
for(i=0;i<5;i++){
for(j=0;j<5;j++){
if(s[j]<s[j+1]){
a=s[j];
s[j]=s[j+1];
s[j+1]=a;
}
}
}
printf("%d %d %d %d %d\n",s[0],s[1],s[2],s[3],s[4]);
return 0;
}
|
main.c:1:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | nclude<stdio.h>
| ^
|
s758578742
|
p00018
|
C
|
#include<stdio.h>
int main(){
int a[5],buf,i,j;
scanf_s("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
for(i=0;i<5;i++){
for(j=5-1;j>0;j--){
if(a[j-1]>a[j]){
buf=a[j-1];
a[j-1]=a[j];
a[j]=buf;
}
}
}
printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
return 0;
}
|
main.c: In function 'main':
main.c:4:1: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
4 | scanf_s("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
| ^~~~~~~
| scanf
|
s448672373
|
p00018
|
C
|
#include<stdio.h>
int main (void){
int i,j,t,max,maxj;
int array[5]={0};
for(i=0;i<5;i++){
scanf("%d",&array[i])
}
for(i=0;i<5;i++){
max=0;
maxj=i;
for(j=i;j<5;j++){
if(max<array[j]){
max = array[j];
maxj = j;
}
}
t = array[i];
array[i] = array[maxj];
array[maxj] = t;
}
printf("%d %d %d %d %d",array[0],array[1],array[2],array[3],array[4]);
return 0;
}
|
main.c: In function 'main':
main.c:9:26: error: expected ';' before '}' token
9 | scanf("%d",&array[i])
| ^
| ;
10 | }
| ~
|
s809740618
|
p00018
|
C
|
#include<stdio.h>
int main(void){
int a[5],i,j;
scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4],);
for(i=0;i<5;i++){
for(j=0;j<4;j++){
int t;
if(a[j]<a[j+1]){
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
}
printf("%d %d %d %d %d",a[0],a[1],a[2],a[3],a[4],);
return 0;
}
|
main.c: In function 'main':
main.c:5:62: error: expected expression before ')' token
5 | scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4],);
| ^
main.c:17:58: error: expected expression before ')' token
17 | printf("%d %d %d %d %d",a[0],a[1],a[2],a[3],a[4],);
| ^
|
s014038294
|
p00018
|
C
|
#include <stdio.h>
int main()
{
int array[100], n, c, d, position, swap;
n=5;
scanf ("%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4]);
for ( c = 0 ; c < ( n - 1 ) ; c++ )
{
position = c;
for ( d = c + 1 ; d < n ; d++ )
{
if ( array[position] > array[d] )
position = d;
}
if ( position != c )
{
swap = array[c];
array[c] = array[position];
array[position] = swap;
}
}
printf("%d ", array[c]);
return 0;
}
|
main.c: In function 'main':
main.c:10:25: error: 'a' undeclared (first use in this function)
10 | scanf ("%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4]);
| ^
main.c:10:25: note: each undeclared identifier is reported only once for each function it appears in
|
s690846815
|
p00018
|
C
|
#include<stdio.h>
int main(void){
int a[10], b[10], c[10], n, i;
scanf("%d %d %d %d %d", &a[1], &a[2], &a[3], &a[4], &a[5]);
a[1] = b[1];
a[2] = b[2];
a[3] = b[3];
a[4] = b[4];
a[5] = b[5];
for ( i = 1; 1 <= 5; i++ ) {
for ( n = 1; 1 <= 5; n++ ) {
if ( a[i] > b[n]) {
c = b[i];
b[n] = a[i];
b[i] = c;
}
}
}
return 0;
}
|
main.c: In function 'main':
main.c:13:15: error: assignment to expression with array type
13 | c = b[i];
| ^
main.c:15:18: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
15 | b[i] = c;
| ^
|
s881008477
|
p00018
|
C
|
#include<stdio.h>
int main(){
int n[6],i,j,t;
for(i=0;i<5;i++)scanf("%d",&n[i]);
for(i=0;i<5;i++){
for(j=i;j<5;j++){
if(n[i]<n[j]){
t=n[i];n[i]=n[j];n[j]=t;
}
}
}
for(printf("%d",n[0]),i=1;i<5;i++)printf(" %d",n[i]);
printf("\n");
eixt(0);
}
|
main.c: In function 'main':
main.c:14:9: error: implicit declaration of function 'eixt' [-Wimplicit-function-declaration]
14 | eixt(0);
| ^~~~
|
s794957225
|
p00018
|
C
|
int s[];M(int*a){return*1[&a]-*a;}
main(){
scanf("%d%d%d%d%d",&s[0],&s[1],&s[2],&s[3],$s[4]);
qsort(s,4,4,M);
printf("%d %d %d %d %d\n",s[0],s[1],s[2],s[3],s[4]);
return 0;
}
|
main.c:1:9: error: return type defaults to 'int' [-Wimplicit-int]
1 | int s[];M(int*a){return*1[&a]-*a;}
| ^
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main(){
| ^~~~
main.c: In function 'main':
main.c:3:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
3 | scanf("%d%d%d%d%d",&s[0],&s[1],&s[2],&s[3],$s[4]);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int s[];M(int*a){return*1[&a]-*a;}
main.c:3:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
3 | scanf("%d%d%d%d%d",&s[0],&s[1],&s[2],&s[3],$s[4]);
| ^~~~~
main.c:3:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:3:52: error: '$s' undeclared (first use in this function); did you mean 's'?
3 | scanf("%d%d%d%d%d",&s[0],&s[1],&s[2],&s[3],$s[4]);
| ^~
| s
main.c:3:52: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:9: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
4 | qsort(s,4,4,M);
| ^~~~~
main.c:5:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
5 | printf("%d %d %d %d %d\n",s[0],s[1],s[2],s[3],s[4]);
| ^~~~~~
main.c:5:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:5:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:5:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:1:5: warning: array 's' assumed to have one element
1 | int s[];M(int*a){return*1[&a]-*a;}
| ^
|
s999980909
|
p00018
|
C
|
null
|
main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
1 | null
| ^~~~
|
s289209326
|
p00018
|
C
|
null
|
main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
1 | null
| ^~~~
|
s807593077
|
p00018
|
C
|
a[9],m;main(){while(~scanf("%d",a+m++));for(qsort(a,--m,4,"\x8b\x00\x2b\x06\xc3");m;printf("%d%c",a[m],--m?32:10));
|
main.c:1:1: warning: data definition has no type or storage class
1 | a[9],m;main(){while(~scanf("%d",a+m++));for(qsort(a,--m,4,"\x8b\x00\x2b\x06\xc3");m;printf("%d%c",a[m],--m?32:10));
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:6: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
1 | a[9],m;main(){while(~scanf("%d",a+m++));for(qsort(a,--m,4,"\x8b\x00\x2b\x06\xc3");m;printf("%d%c",a[m],--m?32:10));
| ^
main.c:1:8: error: return type defaults to 'int' [-Wimplicit-int]
1 | a[9],m;main(){while(~scanf("%d",a+m++));for(qsort(a,--m,4,"\x8b\x00\x2b\x06\xc3");m;printf("%d%c",a[m],--m?32:10));
| ^~~~
main.c: In function 'main':
main.c:1:22: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | a[9],m;main(){while(~scanf("%d",a+m++));for(qsort(a,--m,4,"\x8b\x00\x2b\x06\xc3");m;printf("%d%c",a[m],--m?32:10));
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | a[9],m;main(){while(~scanf("%d",a+m++));for(qsort(a,--m,4,"\x8b\x00\x2b\x06\xc3");m;printf("%d%c",a[m],--m?32:10));
main.c:1:22: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | a[9],m;main(){while(~scanf("%d",a+m++));for(qsort(a,--m,4,"\x8b\x00\x2b\x06\xc3");m;printf("%d%c",a[m],--m?32:10));
| ^~~~~
main.c:1:22: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:45: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
1 | a[9],m;main(){while(~scanf("%d",a+m++));for(qsort(a,--m,4,"\x8b\x00\x2b\x06\xc3");m;printf("%d%c",a[m],--m?32:10));
| ^~~~~
main.c:1:85: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | a[9],m;main(){while(~scanf("%d",a+m++));for(qsort(a,--m,4,"\x8b\x00\x2b\x06\xc3");m;printf("%d%c",a[m],--m?32:10));
| ^~~~~~
main.c:1:85: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:85: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:85: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:1: error: expected declaration or statement at end of input
1 | a[9],m;main(){while(~scanf("%d",a+m++));for(qsort(a,--m,4,"\x8b\x00\x2b\x06\xc3");m;printf("%d%c",a[m],--m?32:10));
| ^
|
s236848281
|
p00018
|
C
|
a[9],m;main(){for(;~scanf("%d",a+m++)||qsort(a,--m,4,M)*m&&printf("%d%c",a[m],--m?32:10););}
|
main.c:1:1: warning: data definition has no type or storage class
1 | a[9],m;main(){for(;~scanf("%d",a+m++)||qsort(a,--m,4,M)*m&&printf("%d%c",a[m],--m?32:10););}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:6: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
1 | a[9],m;main(){for(;~scanf("%d",a+m++)||qsort(a,--m,4,M)*m&&printf("%d%c",a[m],--m?32:10););}
| ^
main.c:1:8: error: return type defaults to 'int' [-Wimplicit-int]
1 | a[9],m;main(){for(;~scanf("%d",a+m++)||qsort(a,--m,4,M)*m&&printf("%d%c",a[m],--m?32:10););}
| ^~~~
main.c: In function 'main':
main.c:1:21: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | a[9],m;main(){for(;~scanf("%d",a+m++)||qsort(a,--m,4,M)*m&&printf("%d%c",a[m],--m?32:10););}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | a[9],m;main(){for(;~scanf("%d",a+m++)||qsort(a,--m,4,M)*m&&printf("%d%c",a[m],--m?32:10););}
main.c:1:21: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | a[9],m;main(){for(;~scanf("%d",a+m++)||qsort(a,--m,4,M)*m&&printf("%d%c",a[m],--m?32:10););}
| ^~~~~
main.c:1:21: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:40: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
1 | a[9],m;main(){for(;~scanf("%d",a+m++)||qsort(a,--m,4,M)*m&&printf("%d%c",a[m],--m?32:10););}
| ^~~~~
main.c:1:54: error: 'M' undeclared (first use in this function)
1 | a[9],m;main(){for(;~scanf("%d",a+m++)||qsort(a,--m,4,M)*m&&printf("%d%c",a[m],--m?32:10););}
| ^
main.c:1:54: note: each undeclared identifier is reported only once for each function it appears in
main.c:1:60: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | a[9],m;main(){for(;~scanf("%d",a+m++)||qsort(a,--m,4,M)*m&&printf("%d%c",a[m],--m?32:10););}
| ^~~~~~
main.c:1:60: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:60: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:60: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s305299772
|
p00018
|
C
|
*a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
|
main.c:1:1: warning: data definition has no type or storage class
1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
| ^
main.c:1:2: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
| ^
main.c:1:4: error: initialization of 'int *' from incompatible pointer type 'int **' [-Wincompatible-pointer-types]
1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
| ^
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
| ^~~~
main.c: In function 'main':
main.c:1:7: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:19: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
main.c:1:19: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
| ^~~~~
main.c:1:19: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:36: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
| ^~~~~~
main.c:1:36: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:36: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:36: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:69: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
| ^~~~~
main.c:1:95: error: expected expression before '%' token
1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf("%d%c",*--a,i+9,main(23)):qsort(a-5,5,4,"\213+Ã");%
| ^
main.c:1:95: error: expected declaration or statement at end of input
|
s893399853
|
p00018
|
C
|
#include<stdio.h>
#include<stdlib.h>
int a[6],i;
int comp(const void *p,const void *q){
return *(int *)q-*(int *)p;
}
int main(){
scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
qsort(a,5,sizeof(int),comp);
for(i=0;i<5;i++)printf("%d%c",a[i],i==4?'':' ');
return 0;
}
|
main.c: In function 'main':
main.c:13:49: error: empty character constant
13 | for(i=0;i<5;i++)printf("%d%c",a[i],i==4?'':' ');
| ^~
|
s626941776
|
p00018
|
C
|
#include<stdio.h>
#include<stdlib.h>
int a[6],i;
int comp(const void *p,const void *q){
return *(int *)q-*(int *)p;
}
int main(){
scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
qsort(a,5,sizeof(int),comp);
for(i=0;i<5;i++)printf("%d%c",a[i],(i==4)?(''):(' '));
return 0;
}
|
main.c: In function 'main':
main.c:13:52: error: empty character constant
13 | for(i=0;i<5;i++)printf("%d%c",a[i],(i==4)?(''):(' '));
| ^~
|
s071965668
|
p00018
|
C
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] data = new int[5];
for ( int i = 0; i < 5; i++ )
data[i] = sc.nextInt();
Arrays.sort(data);
System.out.println(data[4]+" "+data[3]+" "+data[2]+" "+data[1]+" "+data[0]);
}
}
|
main.c:1:1: error: unknown type name 'import'
1 | import java.util.*;
| ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
1 | import java.util.*;
| ^
main.c:3:1: error: unknown type name 'public'
3 | public class Main {
| ^~~~~~
main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
3 | public class Main {
| ^~~~
|
s509469837
|
p00018
|
C
|
main(){int a;for(;~scanf("%d",&a);){if(a>9)while(1);if(a<0)abort();}
|
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
1 | main(){int a;for(;~scanf("%d",&a);){if(a>9)while(1);if(a<0)abort();}
| ^~~~
main.c: In function 'main':
main.c:1:20: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | main(){int a;for(;~scanf("%d",&a);){if(a>9)while(1);if(a<0)abort();}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | main(){int a;for(;~scanf("%d",&a);){if(a>9)while(1);if(a<0)abort();}
main.c:1:20: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | main(){int a;for(;~scanf("%d",&a);){if(a>9)while(1);if(a<0)abort();}
| ^~~~~
main.c:1:20: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:60: error: implicit declaration of function 'abort' [-Wimplicit-function-declaration]
1 | main(){int a;for(;~scanf("%d",&a);){if(a>9)while(1);if(a<0)abort();}
| ^~~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'abort'
+++ |+#include <stdlib.h>
1 | main(){int a;for(;~scanf("%d",&a);){if(a>9)while(1);if(a<0)abort();}
main.c:1:60: warning: incompatible implicit declaration of built-in function 'abort' [-Wbuiltin-declaration-mismatch]
1 | main(){int a;for(;~scanf("%d",&a);){if(a>9)while(1);if(a<0)abort();}
| ^~~~~
main.c:1:60: note: include '<stdlib.h>' or provide a declaration of 'abort'
main.c:1:1: error: expected declaration or statement at end of input
1 | main(){int a;for(;~scanf("%d",&a);){if(a>9)while(1);if(a<0)abort();}
| ^~~~
|
s340094515
|
p00018
|
C
|
#include <stdio.h>
void swap(int *x, int *y){
int temp;
temp = *x;
*x = *y;
*y = temp;
}
int main(void){
int i;
int lbflag;
int num[5];
for(i = 0; i < 5; i++){
scanf("%d",num+i);
}
while(1){
lbflag = 1;
for(i = 0; i < 4; i++){
if(num[i] < num[i+1]){
swap(num+i, num+i+1);
}
}
for(i = 0; i < 4; i++){
if(num[i] < num[i+1]){
lbflag = 0;
break;
}
}
if(lbflag){break;}
}
for(i = 0; i < 5; i++){
printf("%d",num[i]);
if(i != 4){putchar(' ');}
}
putchar('\n');
return 0;
|
main.c: In function 'main':
main.c:37:9: error: expected declaration or statement at end of input
37 | return 0;
| ^~~~~~
|
s564034915
|
p00018
|
C
|
#include <stdio.h>
void qsort(int *data,int size);
void swap(int *a,int *b);
int main(void){
int i;
int data[5];
for(i=0;i<5;i++) scanf("%d",&a[i]);
qsort(data,5);
for(i=0;i<5;i++) printf("%d ",a[i]);
return 0;
}
vod qsort(int *data,int size){
int i,last=1;
if(size<2)return;
for(i=1;i<size;i++){
if(data[0]<data[i]){ swap(&data[last],&data[i]);
last++;
}
}
swap(&data[0],&data[last-1]);
qsort(data,last);
qsort(data+last,size-last);
}
void swap(int *a,int *b){
int work;
work=a[0];
a[0]=b[0];
b[0]=work;
}
|
main.c: In function 'main':
main.c:7:30: error: 'a' undeclared (first use in this function)
7 | for(i=0;i<5;i++) scanf("%d",&a[i]);
| ^
main.c:7:30: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:12:1: error: unknown type name 'vod'; did you mean 'void'?
12 | vod qsort(int *data,int size){
| ^~~
| void
main.c:12:5: error: conflicting types for 'qsort'; have 'int(int *, int)'
12 | vod qsort(int *data,int size){
| ^~~~~
main.c:2:6: note: previous declaration of 'qsort' with type 'void(int *, int)'
2 | void qsort(int *data,int size);
| ^~~~~
main.c: In function 'qsort':
main.c:14:11: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
14 | if(size<2)return;
| ^~~~~~
main.c:12:5: note: declared here
12 | vod qsort(int *data,int size){
| ^~~~~
|
s645129508
|
p00018
|
C
|
#include <stdio.h>
void qsort(int *data,int size);
void swap(int *a,int *b);
int main(void){
int i;
int data[5];
for(i=0;i<5;i++) scanf("%d",&data[i]);
qsort(data,5);
for(i=0;i<5;i++) printf("%d ",data[i]);
return o;
}
void qsort(int *data,int size){
int i,last=1;
if(size<2)return;
for(i=1;i<size;i++){
if(data[0]<data[i]){ swap(&data[last],&data[i]);
last++;
}
}
swap(&data[0],&data[last-1]);
qsort(data,last);
qsort(data+last,size-last);
}
void swap(int *a,int *b){
int work;
work=a[0];
a[0]=b[0];
b[0]=work;
}
|
main.c: In function 'main':
main.c:10:8: error: 'o' undeclared (first use in this function)
10 | return o;
| ^
main.c:10:8: note: each undeclared identifier is reported only once for each function it appears in
|
s572044159
|
p00018
|
C
|
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int i;
vector<int> vec(5.0);
for(i = 0 ; i<5 ; i++){
cin >> vec[i];
}
sort(vec.begin() , vec.end() );
for(i = 4; i>=0 ; i--){
if(i == 0) cout << vec[i] << endl;
else cout << vec[i] <<" ";
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s535217463
|
p00018
|
C
|
include <stdio.h>
int main(void)
{
int p[5];
int n=5;
int i,j,temp;
for(i=0;i<5;i++){
scanf("%d",&p[i]);
}
for(i=0;i<n-1;i++){
for(j=n-1;j>i;j--){
if(p[j-1]>p[j]){
temp=p[j];
p[j]=p[j-1];
p[j-1]=temp;
}
}
}
for(i=0;i<5;i++){
printf("%d",p[i]);
if(i<4){
printf(" ");
}
else{
printf("\n");
}
}
return 0;
}
|
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include <stdio.h>
| ^
|
s353515884
|
p00018
|
C
|
include <stdio.h>
int main(void)
{
int p[5];
int n=5;
int i,j,temp;
for(i=0;i<5;i++){
scanf("%d",&p[i]);
}
for(i=0;i<n-1;i++){
for(j=n-1;j>i;j--){
if(p[j-1]>p[j]){
temp=p[j];
p[j]=p[j-1];
p[j-1]=temp;
}
}
}
for(i=0;i<5;i++){
printf("%d",p[i]);
if(i<4){
printf(" ");
}
}
return 0;
}
|
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include <stdio.h>
| ^
|
s402722670
|
p00018
|
C
|
#include <stdio.h>
int main()
{
int i,j,a[5];
scanf("%d %d %d %d %d",a,a+1,a+2,a+3,a+4);
for(i=0;i<5;i++){
for(j=i+1;j<5;j++){
if(a[i]<a[j]){
t=a[i];a[i]=a[j];a[j]=t;
}
}
}
printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
return 0;
}
|
main.c: In function 'main':
main.c:11:33: error: 't' undeclared (first use in this function)
11 | t=a[i];a[i]=a[j];a[j]=t;
| ^
main.c:11:33: note: each undeclared identifier is reported only once for each function it appears in
|
s966314079
|
p00018
|
C++
|
#include <iostream>
#include <memory>
using namespace std;
namespace sorting_five_numbers
{
class SortingFiveNumbers
{
private:
//! データサイズ
static const int Size = 5;
//! 入力値
int dataList[Size];
public:
/**
* @brief コンストラクタ
*/
SortingFiveNumbers(int target[]) {
memset(dataList, 0, Size);
for (int i = 0; i < Size; i++) {
dataList[i] = target[i];
}
}
/**
* @fn int* createDescendingList()
* @brief 降順にソートしたリストを生成する
* @return int* ソート済みリスト
*/
int* createDescendingList();
};
class Control
{
private:
//! データサイズ
static const int Size = 5;
public:
/**
* @fn bool executeEx()
* @brief 5つの整数を読み込み、降順に整列し出力する
* @return bool 入力値が範囲内ならtrueを、そうでなければfalseを返す
*/
bool executeEx();
private:
/**
* @fn void read(int target[])
* @brief 標準入力から読み込む
* @param[out] target 入力データ
*/
void read(int target[]);
/**
* @fn void write(int target[])
* @brief 標準出力に書き込む
* @param[in] target 出力データ
*/
void write(int target[]);
/**
* @fn bool check(int target[])
* @brief 入力データが範囲内か調べる
* @param[in] target 調査対象
* @return bool 入力データが範囲内ならtrueを、そうでなければfalseを返す
*/
bool check(int target[]);
};
}
using namespace sorting_five_numbers;
int* SortingFiveNumbers::createDescendingList()
{
for (int i = 0; i < Size - 1; i++) {
int max = i;
for (int j = i + 1; j < Size; j++) {
if (dataList[max] < dataList[j]) {
max = j;
}
}
int t = dataList[i];
dataList[i] = dataList[max];
dataList[max] = t;
}
return dataList;
}
bool Control::executeEx()
{
int input[Size] = { 0 };
int* output = NULL;
read(input);
if (!check(input))
return false;
SortingFiveNumbers list(input);
output = list.createDescendingList();
write(output);
return true;
}
void Control::read(int target[])
{
for (int i = 0; i < Size; i++)
cin >> target[i];
}
void Control::write(int target[])
{
for (int i = 0; i < Size; i++) {
(i != Size) ? cout << target[i] << " " : cout << target[i] << endl;
}
}
bool Control::check(int target[])
{
static const int Min = -100000;
static const int Max = 100000;
for (int i = 0; i < Size; i++) {
if (Min > target[i] || Max < target[i])
return false;
}
return true;
}
int main()
{
if (!Control().executeEx())
return 1;
}
|
a.cc: In constructor 'sorting_five_numbers::SortingFiveNumbers::SortingFiveNumbers(int*)':
a.cc:22:13: error: 'memset' was not declared in this scope
22 | memset(dataList, 0, Size);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <memory>
+++ |+#include <cstring>
3 |
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.