submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s303703874 | p00086 | C++ | #include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
int n, m, s, t = 0;
int d[110][110], used[110];
/*v????????¨??°???t????¨?????????????????????°*/
bool solve(int v,int count) {
if (used[v] == 0) {
used[v] == 1; count++;
}
if (d[2][v] > 0 || d[v][2] > 0 && count == t - 1)return true;
for (int u = 3; u <= t; u++) {
if (v <= u&&d[v][u]>0) {
d[v][u]--; if (solve(u, count)) return true;
}
else if (v > u&&d[u][v] > 0 ) {
d[u][v]--; if (solve(u, count))return true;
}
}
return false;
}
int main() {
for (int i = 0; i < 110; i++) {
used[110] = 0;
for (int j = 0; j < 110; j++) {
d[i][j] = 0;
}
}
while (scanf_s("%d %d", &n, &m)) {
if (n == 0 && m == 0)break;
s = max(n, m);
t = max(t, s);
d[min(n, m)][s]++;
}
if (solve(1,1))printf("OK\n");
else printf("NG\n");
} | a.cc: In function 'int main()':
a.cc:32:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
32 | while (scanf_s("%d %d", &n, &m)) {
| ^~~~~~~
| scanf
|
s627252343 | p00086 | C++ | #include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
int n, m, s, t = 0;
int d[110][110], used[110];
/*v????????¨??°???t????¨?????????????????????°*/
bool solve(int v,int count) {
if (used[v] == 0) {
used[v] = 1; count++;
}
if (d[2][v] > 0 || d[v][2] > 0 && count == t - 1)return true;
for (int u = 3; u <= t; u++) {
if (v <= u&&d[v][u]>0) {
d[v][u]--; if (solve(u, count)) return true;
}
else if (v > u&&d[u][v] > 0 ) {
d[u][v]--; if (solve(u, count))return true;
}
}
return false;
}
int main() {
for (int i = 0; i < 110; i++) {
used[110] = 0;
for (int j = 0; j < 110; j++) {
d[i][j] = 0;
}
}
while (scanf_s("%d %d", &n, &m)) {
if (n == 0 && m == 0)break;
s = max(n, m);
t = max(t, s);
d[min(n, m)][s]++;
}
if (solve(1,1))printf("OK\n");
else printf("NG\n");
} | a.cc: In function 'int main()':
a.cc:32:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
32 | while (scanf_s("%d %d", &n, &m)) {
| ^~~~~~~
| scanf
|
s655801413 | p00086 | C++ | #include<stdio.h>
int way[200];
int a,b;
int cou=0;
int main()
{
while(scanf("%d%d",&a,&b)!=-1)
{
for(int i=0;i<200;i++)
{
way[i]=0;
}
cou=0;
way[a]++;
way[b]++;
while(1)
{
scanf("%d%d",&a,&b);
if(a==0&&b==0)break;
way[a]++;
way[b]++;
}
else if(way[1]%2==1&&way[2]%2==1)
{
cou=0;
for(int i=3;i<200;i++)
{
if(way[i]%2!=0)break;
cou++;
}
if(cou==197)printf("OK\n");
else printf("NG\n");
}
else printf("NG\n");
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:9: error: 'else' without a previous 'if'
23 | else if(way[1]%2==1&&way[2]%2==1)
| ^~~~
|
s219735835 | p00086 | C++ | #include "stdafx.h"
#include <algorithm> // sort ?????????
#include <string> // string (?????????) ?????????
#include<iostream>
using namespace std;
int N[256] = { 0 },a,b;
bool ok() {
if (N[1] % 2 == 0)return false;
if (N[2] % 2 == 0)return false;
for (int i = 3; i < 256; i++) {
if (N[i] % 2 == 1)return false;
}
return true;
}
int main() {
while (cin >> a >> b) {
N[a] += 1;
N[b] += 1;
if (a == 0 && b == 0) {
if (ok)cout << "OK" << endl;
else cout << "NG" << endl;
for (int i = 0; i < 256; i++)N[i] = 0;
}
}
return 0;
} | a.cc:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s984016043 | p00086 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
while (true)
{
int x[200] = {};
int a;
cin >> a;
if (cin.eof()) { break; }
while (true)
{
x[a]++;
x[a] = x[a] % 2;
cin >> a;
if (a == 0) { break; }
}
int count = 0;
for(int i=1;i<101;i++){
if (x[i] == 1) { count++; }
}
if(count ==0||count == 2){
cout << "OK" << endl;
}
else{
cout << "NG" << endl;
}
}
return 0; | a.cc: In function 'int main()':
a.cc:30:14: error: expected '}' at end of input
30 | return 0;
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s385263158 | p00086 | C++ | #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int c[100];
int main() {
int a, b;
while (cin >> a >> b) {
if (a == 0 && b == 0) {
bool k = (c[0] % 2 == c[1] % 2);
for (int i = 2; i < 100; i++) {
if (c[i] & 1)k = false;
}
if (k)puts("OK");
else puts("NG");
memset(c, 0, sizeof(c));
}
else {
a--; b--;
c[a]++; c[b]++;
}
}
} | a.cc: In function 'int main()':
a.cc:20:25: error: 'memset' was not declared in this scope
20 | memset(c, 0, sizeof(c));
| ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include<queue>
+++ |+#include <cstring>
7 | using namespace std;
|
s186919808 | p00086 | C++ | #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int c[100];
int main() {
int a, b;
while (cin >> a >> b) {
if (a == 0 && b == 0) {
bool k = true;
for (int i = 2; i < 100; i++) {
if (c[i] & 1)k = false;
}
if (k)puts("OK");
else puts("NG");
memset(c, 0, sizeof(c));
}
else {
a--; b--;
c[a]++; c[b]++;
}
}
} | a.cc: In function 'int main()':
a.cc:20:25: error: 'memset' was not declared in this scope
20 | memset(c, 0, sizeof(c));
| ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include<queue>
+++ |+#include <cstring>
7 | using namespace std;
|
s374132475 | p00086 | C++ | #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int c[100];
int main() {
int a, b;
while (cin >> a >> b) {
if (a == 0 && b == 0) {
bool k = c[0] % 2 == 1 && c[1] % 2 == 1;
for (int i = 2; i < 100; i++) {
if (c[i] & 1)k = false;
}
if (k)puts("OK");
else puts("NG");
memset(c, 0, sizeof(c));
}
else {
a--; b--;
c[a]++; c[b]++;
}
}
} | a.cc: In function 'int main()':
a.cc:20:25: error: 'memset' was not declared in this scope
20 | memset(c, 0, sizeof(c));
| ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include<queue>
+++ |+#include <cstring>
7 | using namespace std;
|
s680335660 | p00086 | C++ | #include<iostream>
using namespace std;
int map[110];
bool solve() {
if (map[1] % 2 = 1 && map[2] % 2 == 1) {
for (int i = 3; i <= 100; i++){
if (map[i] % 2 == 1)
return false;
}
return true;
}
else return false;
}
int main() {
int a, b;
while (cin >> a >> b) {
if (!a && !b) {
if (solve()) cout << "OK\n";
else cout << "NG\n";
for (int i = 1; i <= 100; i++)map[i] = 0;
continue;
}
else {
map[a]++;
map[b]++;
}
}
} | a.cc: In function 'bool solve()':
a.cc:5:20: error: lvalue required as left operand of assignment
5 | if (map[1] % 2 = 1 && map[2] % 2 == 1) {
| ~~~~~~~^~~
a.cc:13:1: warning: control reaches end of non-void function [-Wreturn-type]
13 | }
| ^
|
s223689363 | p00086 | C++ | node = {}
readlines.map(&:chomp).each{|line|
s, t = line.split.map(&:to_i)
if s == 0 && t == 0
if node[1] % 2 != node[2] % 2
puts "NG"
else
node.delete(1)
node.delete(2)
cnt = 0
node.each{|h, k|
cnt += 1 if k % 2 == 1
}
if cnt == 0
puts "OK"
else
puts "NG"
end
end
node = {}
next
end
node[s] ||= 0
node[t] ||= 0
node[s] += 1
node[t] += 1
} | a.cc:1:1: error: 'node' does not name a type
1 | node = {}
| ^~~~
a.cc:2:1: error: 'readlines' does not name a type
2 | readlines.map(&:chomp).each{|line|
| ^~~~~~~~~
|
s119621081 | p00086 | C++ | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
| |
s071242914 | p00086 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(void){
int i,a,b,flg,s[104];
while(1){
memset(s,0,sizeof(s));
while(1){
if(!(cin>>a>>b)) return 0;
if(!a && !b) break;
s[a]++;
s[b]++;
}
flg = 0;
if(s[1] % 2 == 1 && s[2] % 2 == 1){
flg = 1;
}
for(i=3;i<104 && flg==1;i++){
if(s[i] != 0 && s[i] % 2 == 1){
flg = 0;
}
}
if(flg){
cout<<"OK\n";
}
else{
cout<<"NG\n";
}
}
} | a.cc: In function 'int main()':
a.cc:9:5: error: 'memset' was not declared in this scope
9 | memset(s,0,sizeof(s));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | #include <string>
|
s139362447 | p00086 | C++ | d[100],z[100]={1,1};main(a){for(;~scanf("%d 0",&a);)a--?(d[a]^=1):memset(d,0,400,puts(memcmp(d,z,400)?"NG":"OK"));} | a.cc:1:1: error: 'd' does not name a type
1 | d[100],z[100]={1,1};main(a){for(;~scanf("%d 0",&a);)a--?(d[a]^=1):memset(d,0,400,puts(memcmp(d,z,400)?"NG":"OK"));}
| ^
a.cc:1:25: error: expected constructor, destructor, or type conversion before '(' token
1 | d[100],z[100]={1,1};main(a){for(;~scanf("%d 0",&a);)a--?(d[a]^=1):memset(d,0,400,puts(memcmp(d,z,400)?"NG":"OK"));}
| ^
|
s979734031 | p00086 | C++ | #include <iostream>
#include <map>
using namespace std;
const int size = 101;
int G[size][size];
int C[size];
map <int, int> M;
int M_index;
bool flag;
void set_index( int a )
{
if ( M.find( a ) != M.end() ) return;
M[a] = M_index;
M_index++;
}
void init()
{
memset( G, 0, sizeof(G) );
memset( C, 0, sizeof(C) );
M.clear();
flag = false;
}
int main( void )
{
int a, b;
flag = true;
while ( cin >> a >> b ) {
if ( a == 0 && b == 0 ) {
for ( int i = 0; i < size; i++ ) {
for ( int j = 0; j < size; j++ ) {
if ( G[i][j] > 0 ) C[i] += G[i][j];
}
}
bool ok = true;
int start = M[1], goal = M[2];
for ( int i = 0; i < size; i++ ) {
if ( !C[i] ) continue;
if ( i == start || i == goal ) {
if ( C[i] % 2 == 0 ) ok = false;
} else {
if ( C[i] % 2 != 0 ) ok = false;
}
}
// output
cout << ( ok ? "OK" : "NG" ) << endl;
flag = true;
} else {
if ( flag ) {
init();
}
set_index( a );
set_index( b );
int index_a = M[a], index_b = M[b];
G[index_a][index_b]++;
G[index_b][index_a]++;
}
}
return 0;
} | a.cc:6:7: error: reference to 'size' is ambiguous
6 | int G[size][size];
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:5:11: note: 'const int size'
5 | const int size = 101;
| ^~~~
a.cc:6:13: error: reference to 'size' is ambiguous
6 | int G[size][size];
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:5:11: note: 'const int size'
5 | const int size = 101;
| ^~~~
a.cc:7:7: error: reference to 'size' is ambiguous
7 | int C[size];
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:5:11: note: 'const int size'
5 | const int size = 101;
| ^~~~
a.cc: In function 'void init()':
a.cc:21:11: error: 'G' was not declared in this scope
21 | memset( G, 0, sizeof(G) );
| ^
a.cc:21:3: error: 'memset' was not declared in this scope
21 | memset( G, 0, sizeof(G) );
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <map>
+++ |+#include <cstring>
3 | using namespace std;
a.cc:22:11: error: 'C' was not declared in this scope
22 | memset( C, 0, sizeof(C) );
| ^
a.cc: In function 'int main()':
a.cc:33:28: error: reference to 'size' is ambiguous
33 | for ( int i = 0; i < size; i++ ) {
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:5:11: note: 'const int size'
5 | const int size = 101;
| ^~~~
a.cc:34:30: error: reference to 'size' is ambiguous
34 | for ( int j = 0; j < size; j++ ) {
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:5:11: note: 'const int size'
5 | const int size = 101;
| ^~~~
a.cc:35:16: error: 'G' was not declared in this scope
35 | if ( G[i][j] > 0 ) C[i] += G[i][j];
| ^
a.cc:35:30: error: 'C' was not declared in this scope
35 | if ( G[i][j] > 0 ) C[i] += G[i][j];
| ^
a.cc:40:28: error: reference to 'size' is ambiguous
40 | for ( int i = 0; i < size; i++ ) {
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:5:11: note: 'const int size'
5 | const int size = 101;
| ^~~~
a.cc:41:15: error: 'C' was not declared in this scope
41 | if ( !C[i] ) continue;
| ^
a.cc:43:16: error: 'C' was not declared in this scope
43 | if ( C[i] % 2 == 0 ) ok = false;
| ^
a.cc:45:16: error: 'C' was not declared in this scope
45 | if ( C[i] % 2 != 0 ) ok = false;
| ^
a.cc:58:7: error: 'G' was not declared in this scope
58 | G[index_a][index_b]++;
| ^
|
s420109935 | p00086 | C++ | #include<iostream>#include<cstdio>using namespace std;int main(){ for(;;){ int a,b,x = 0; int field[100] = {0}; for(;;){ if(scanf("%d %d",&a,&b) == EOF){goto jump;} if(!a && !b){break;} field[a]++; field[b]++; } for(int i=0; i<100; i++){ if(field[i]%2 == 1){x++;} } if(x == 2){cout <<"OK"<<endl;} else{cout <<"NG"<<endl;} } jump:; return 0;} | a.cc:1:19: warning: extra tokens at end of #include directive
1 | #include<iostream>#include<cstdio>using namespace std;int main(){ for(;;){ int a,b,x = 0; int field[100] = {0}; for(;;){ if(scanf("%d %d",&a,&b) == EOF){goto jump;} if(!a && !b){break;} field[a]++; field[b]++; } for(int i=0; i<100; i++){ if(field[i]%2 == 1){x++;} } if(x == 2){cout <<"OK"<<endl;} else{cout <<"NG"<<endl;} } jump:; return 0;}
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s869450268 | p00086 | C++ | #include <iostream>
#include <vector>
using namespace std;
int v[101];
int main(){
int a, b;
bool ng = false;
while(cin >> a >> b){
v[a]++, v[b]++;
if(a == 0){
if(v[1] + v[2] % 2 == 1){
ng = true;
}
for(int i=3; i<101; ++i){
if(v[i] % 2 == 1){
ng = true;
}
}
if(ng){
cout << "NG" << endl;
} else {
cout << "OK" << endl;
}
memset(v, 0, sizeof(v));
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:7: error: 'memset' was not declared in this scope
26 | memset(v, 0, sizeof(v));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | using namespace std;
|
s046572725 | p00086 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
int main() {
int a, b;
int degree[5000] = {0};
while (cin >> a, cin >> b) {
if (a == -1 && b == -1) break;
degree[a]++;
degree[b]++;
if (a == 0) {
int flg = 0;
for (int i = 0; i < 5000; i++)
if (degree[i]%2 && i != 1 && i != 2) flg++;
if (flg) cout << "NG" << endl;
else cout << "OK" << endl;
memset(degree, 0, sizeof(degree));
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:7: error: 'memset' was not declared in this scope
19 | memset(degree, 0, sizeof(degree));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cstdio>
+++ |+#include <cstring>
3 |
|
s999447197 | p00086 | C++ | #include <cstring>
#include <iostream>
using namespace std;
const int MAX_NODE = 100;
int main() {
int nodes[MAX_NODE + 1];
int last = 0, from, to;
memset(nodes, 0, sizeof(nodes));
while (cin >> from >> to) {
if (from == 0 && to == 0) {
if ((nodes[1] & 1) && (nodes[2] & 1)
&& all_of(nodes + 3, nodes + last + 1,
[](int i){return !((i) & 1);})) {
cout << "OK" << endl;
}
else {
cout << "NG" << endl;
}
last = 0;
memset(nodes, 0, sizeof(nodes));
}
else {
nodes[from]++;
nodes[to]++;
last = max(last, max(from, to));
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:44: error: 'all_of' was not declared in this scope
15 | && all_of(nodes + 3, nodes + last + 1,
| ^~~~~~
|
s987580338 | p00086 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
while(!feof(stdin)){
int G[1000]={0};
int a,b;
int mx = 0;
while( cin >> a >> b , a+b ){
G[b]++,G[a]++;
mx = max(mx,max(a,b));
}
bool flag = true;
for(int i = 3 ; i <= mx ; i++ ){
if(G[i]%2 == 1 && G[i] != 0){
flag = false;
break;
}
}
if( flag == true && G[1]%2 == 1 && G[2]%2 == 1) cout << "OK" << endl;
else cout << "NG" << endl;
}
}
return 0;
} | a.cc:30:3: error: expected unqualified-id before 'return'
30 | return 0;
| ^~~~~~
a.cc:31:1: error: expected declaration before '}' token
31 | }
| ^
|
s462818446 | p00086 | C++ | int main(){
int x[101]={0},i,j;
while(std::cin>>i>>j){
x[1]++;
x[2]++;
while(i!=0&&j!=0){
x[i]^=1;
x[j]^=1;
std::cin>>i>>j;
}
for(i=0;i<101;i++)if(x[i])break;
std::cout<<(i==101?"OK\n":"NG\n");
for(i=0;i<101;i++)x[i]=0;
}
} | a.cc: In function 'int main()':
a.cc:3:20: error: 'cin' is not a member of 'std'
3 | while(std::cin>>i>>j){
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | int main(){
a.cc:9:30: error: 'cin' is not a member of 'std'
9 | std::cin>>i>>j;
| ^~~
a.cc:9:30: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:12:22: error: 'cout' is not a member of 'std'
12 | std::cout<<(i==101?"OK\n":"NG\n");
| ^~~~
a.cc:12:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s079610019 | p00086 | C++ | //include
//------------------------------------------
#include <bits/stdc++.h> // only for GCC
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
//container util
//------------------------------------------
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
//repetition
//------------------------------------------
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)
//constant
//--------------------------------------------
const double eps = 1e-10;
const double pi = acos(-1.0);
const double inf = (int)1e8;
// output vector
// ------------------------------------------
namespace std {
template<typename T>ostream&operator<<(ostream&os, vector<T>const&v){
iter(it,v) os<<*it<<(it+1==v.end()?"":",");
return os;
}
template<typename T, typename U>ostream&operator<<(ostream&os,const pair<T,U>&p){
return os << "[" << p.dirst << "," << p.second << "]";
}
}
//clear memory
// ------------------------------------------
#define clr(a,i) memset((a), (i) ,sizeof(a))
int main(){
int n,m;
vi a(101,0);
while(cin>>n>>m){
if(n+m==0){
if(a[1]%2==0||) cout << "OK" << endl;
else cout<<(count_if(all(a),[](int x){return x%2==1;})==2?"OK":"NG")<<endl;
fill(all(a),0);
continue;
}
a[n]++; a[m]++;
}
} | a.cc: In function 'int main()':
a.cc:59:24: error: expected primary-expression before ')' token
59 | if(a[1]%2==0||) cout << "OK" << endl;
| ^
|
s613753077 | p00086 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
int dim[e+10];
void init() {
fill(dim, dim+110, 0);
}
bool hitofude() {
if ((dim[1]+dim[2])%2) {
return false;
}
for (int i=3; i<e+10; i++) {
if (dim[i]%2) {
return false;
}
}
return true;
}
int main() {
int a,b;
init();
while (scanf("%d%d", &a, &b)!=EOF) {
dim[a]++;
dim[b]++;
if (a==0 && b==0) {
if (hitofude()) {
printf("OK\n");
} else {
printf("NG\n");
}
init();
}
}
} | a.cc:5:9: error: 'e' was not declared in this scope
5 | int dim[e+10];
| ^
a.cc: In function 'void init()':
a.cc:8:8: error: 'dim' was not declared in this scope; did you mean 'div'?
8 | fill(dim, dim+110, 0);
| ^~~
| div
a.cc: In function 'bool hitofude()':
a.cc:12:8: error: 'dim' was not declared in this scope; did you mean 'div'?
12 | if ((dim[1]+dim[2])%2) {
| ^~~
| div
a.cc:15:19: error: 'e' was not declared in this scope
15 | for (int i=3; i<e+10; i++) {
| ^
a.cc:16:9: error: 'dim' was not declared in this scope; did you mean 'div'?
16 | if (dim[i]%2) {
| ^~~
| div
a.cc: In function 'int main()':
a.cc:27:5: error: 'dim' was not declared in this scope; did you mean 'div'?
27 | dim[a]++;
| ^~~
| div
|
s748856466 | p00087 | Java | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class Main{
Scanner sc;
static final int INF=1<<28;
static final double EPS=1e-9;
void run(){
sc=new Scanner(System.in);
for(; sc.hasNext();){
Scanner c=new Scanner(sc.nextLine());
Stack<Double> stack=new Stack<Double>();
for(; c.hasNext();){
String s=c.next();
/*if(Character.isDigit(s.charAt(0))){
stack.push(Double.parseDouble(s));
}else{
double d2=stack.pop();
double d1=stack.pop();
double d=0;
switch(s.charAt(0)){
case '+':
d=d1+d2;
break;
case '-':
d=d1-d2;
break;
case '*':
d=d1*d2;
break;
case '/':
d=d1/d2;
break;
}
stack.push(d);
}*/
}
double ans=stack.pop();
println(ans+"");*/
println("");
}
sc.close();
}
void print(String s){
System.out.print(s);
}
void println(String s){
System.out.println(s);
}
public static void main(String[] args){
new Main().run();
}
} | Main.java:47: error: illegal start of expression
println(ans+"");*/
^
Main.java:47: error: illegal start of expression
println(ans+"");*/
^
2 errors
|
s820823665 | p00087 | Java | import java.util.Scanner;
import java.util.Stack;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNextLine()){
Stack<Double> stack = new Stack<Double>();
for(String s : sc.nextLine().split(" ");){
if(s.equals("+")){
double d2 = stack.pop();
double d1 = stack.pop();
stack.push(d1 + d2);
}else if(s.equals("-")){
double d2 = stack.pop();
double d1 = stack.pop();
stack.push(d1 - d2);
}else if(s.equals("*")){
double d2 = stack.pop();
double d1 = stack.pop();
stack.push(d1 * d2);
}else if(s.equals("/")){
double d2 = stack.pop();
double d1 = stack.pop();
stack.push(d1 / d2);
}else{
stack.push(Double.parseDouble(s));
}
}
System.out.println(stack.pop());
}
}
} | Main.java:12: error: ')' expected
for(String s : sc.nextLine().split(" ");){
^
Main.java:12: error: illegal start of expression
for(String s : sc.nextLine().split(" ");){
^
2 errors
|
s193053098 | p00087 | C | #define _CRT_SECURE_NO_WARNINGS
////#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
void push(double, int, double[]);
double pop(int, double[]);
int main() {
char array[1000000];
char *pt = array, *tok;
int top = 0;
double result[1000],num, a, b;
while (~scanf("%[^\n]*s", pt) != NULL) {
getchar();
memset(result, 0.0, sizeof(result));
tok = strtok(pt, " ");
while (tok != NULL) {
if (*tok == '+') {
a = pop(--top, result);
b = pop(--top, result);
push(a + b, top++, result);
}
else if (*tok == '-') {
b = pop(--top, result);
a = pop(--top, result);
push(a - b, top++, result);
}
else if (*tok == '*') {
a = pop(--top, result);
b = pop(--top, result);
push(a * b, top++, result);
}
else if (*tok == '/') {
a = pop(--top, result);
b = pop(--top, result);
push(a / b, top++, result);
}
else {
num = atof(tok);
push(num, top++, result);
}
tok = strtok(NULL, " ");
}
printf("%lf\n", pop(--top, result));
memset(array, '\0', sizeof(array));
}
return 0;
} | main.c: In function 'main':
main.c:17:39: warning: comparison between pointer and integer
17 | while (~scanf("%[^\n]*s", pt) != NULL) {
| ^~
/usr/bin/ld: /tmp/ccfhJUNv.o: in function `main':
main.c:(.text+0x7e): undefined reference to `pop'
/usr/bin/ld: main.c:(.text+0x9f): undefined reference to `pop'
/usr/bin/ld: main.c:(.text+0xd6): undefined reference to `push'
/usr/bin/ld: main.c:(.text+0xfe): undefined reference to `pop'
/usr/bin/ld: main.c:(.text+0x11f): undefined reference to `pop'
/usr/bin/ld: main.c:(.text+0x156): undefined reference to `push'
/usr/bin/ld: main.c:(.text+0x17e): undefined reference to `pop'
/usr/bin/ld: main.c:(.text+0x19f): undefined reference to `pop'
/usr/bin/ld: main.c:(.text+0x1d6): undefined reference to `push'
/usr/bin/ld: main.c:(.text+0x1fe): undefined reference to `pop'
/usr/bin/ld: main.c:(.text+0x21f): undefined reference to `pop'
/usr/bin/ld: main.c:(.text+0x256): undefined reference to `push'
/usr/bin/ld: main.c:(.text+0x290): undefined reference to `push'
/usr/bin/ld: main.c:(.text+0x2cb): undefined reference to `pop'
collect2: error: ld returned 1 exit status
|
s466093010 | p00087 | C | #include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
void push(double S[],int *top,double x){
S[(*top)]=x;
(*top)++;
return;
}
double pop(double S[],int *top){
(*top)--;
return S[(*top)];
}
int main(){
char str[81];
int i,j;
int R,top;
char temp[10];
double S[80];
double x1,x2;
while(fgets(str,sizeof str,stdin)!=NULL){
R=strlen(str);
j=0; i=0; top=0;
while(i<=R){
if(i<R && str[i]!=' ')temp[j++]=str[i++];
else {
temp[j]='\0';
if(isdigit(temp[0]))
push(S,&top,atof(temp));
else if( !isdigit(temp[0]) && isdigit(temp[1]) )
push(S,&top,atof(temp));/*負の数*/
else {
x1=pop(S,&top);
x2=pop(S,&top);
switch(temp[0]){
case '+':push(S,&top,x2+x1);
break;
case '-':push(S,&top,x2-x1);
break;
case '*':push(S,&top,x2*x1);
break;
case '/':push(S,&top,x2/x1);
break;
}
i++;
}
j=0;
}
}
printf("%.6lf\n",S[0]);
}
return 0;
}
| main.c: In function 'main':
main.c:58:1: error: stray '\343' in program
58 | <U+3000><U+3000><U+3000> i++;
| ^~~~~~~~
main.c:58:3: error: stray '\343' in program
58 | <U+3000><U+3000><U+3000> i++;
| ^~~~~~~~
main.c:58:5: error: stray '\343' in program
58 | <U+3000><U+3000><U+3000> i++;
| ^~~~~~~~
|
s493765576 | p00087 | C | #include <stdio.h>
#include <stdlib.h>
int main(void) {
double stack[200];
char temp[100];
int stackptr=0;
while(1) {
if(scanf("%s",temp)==-1)break;
assert(stackptr >= 2);
if(temp[0]=='+') {
if(stackptr<2)return 1;
stack[stackptr-2]+=stack[stackptr-1];
stackptr--;
} else if(temp[0]=='-') {
if(stackptr<2)return 1;
stack[stackptr-2]-=stack[stackptr-1];
stackptr--;
} else if(temp[0]=='*') {
if(stackptr<2)return 1;
stack[stackptr-2]*=stack[stackptr-1];
stackptr--;
} else if(temp[0]=='/') {
if(stackptr<2)return 1;
if(stack[stackptr-1]==0)return 1;
stack[stackptr-2]/=stack[stackptr-1];
stackptr--;
} else {
stack[stackptr]=atof(temp);
stackptr++;
}
if(getchar()=='\n') {
if(stackptr!=1)return 1;
printf("%f\n",stack[0]);
stackptr=0;
}
}
return 0;
} | main.c: In function 'main':
main.c:10:17: error: implicit declaration of function 'assert' [-Wimplicit-function-declaration]
10 | assert(stackptr >= 2);
| ^~~~~~
main.c:3:1: note: 'assert' is defined in header '<assert.h>'; this is probably fixable by adding '#include <assert.h>'
2 | #include <stdlib.h>
+++ |+#include <assert.h>
3 |
|
s075655033 | p00087 | C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
double plus( double a, double b )
{
return a + b;
}
double minus( double a, double b )
{
return a - b;
}
double product( double a, double b )
{
return a * b;
}
double divide( double a, double b )
{
return a / b;
}
double (*calculation[4])() = {plus, minus, product, divide};
void rpn( char *t, double stack[], int *stack_ptr )
{
char strOperator[] = "+\0-\0*\0/";
int i;
for( i = 0;i < 4;i++ ) if( strcmp( &strOperator[i * 2], t ) == 0 ) break;
if( i != 4 ){
(*stack_ptr)--;
stack[*stack_ptr - 1] = ( *calculation[i] )( stack[*stack_ptr - 1], stack[*stack_ptr] );
} else {
stack[ (*stack_ptr)++ ] = atof( t );
}
}
int main(void)
{
char str[81],*t;
double stack[81];
int i,stack_ptr;
while( 1 ){
gets( str );
if( strcmp( str, "0" ) == 0 ) break;
for( i = 0;i < 81;i++ ){
stack[i] = 0;
}
stack_ptr = 0;
t = strtok( str, " " );
rpn( t, stack, &stack_ptr );
while( ( t = strtok( NULL, " ") ) != NULL ){
rpn( t, stack, &stack_ptr );
}
printf("%f\n", stack[0] );
}
return 0;
} | main.c: In function 'main':
main.c:39:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
39 | gets( str );
| ^~~~
| fgets
|
s631243722 | p00087 | C | char s[];main(){double*q,b;for(q=a+9;~scanf("%s",s);getchar()<14&&printf("%f\n",*q)){!sscanf(s,"%lf",q+1)?b=*q--,*q=*s-47?*s-42?*s-45?*q+b:*q-b:*q*b:*q/b:*++q;}} | main.c:1:10: error: return type defaults to 'int' [-Wimplicit-int]
1 | char s[];main(){double*q,b;for(q=a+9;~scanf("%s",s);getchar()<14&&printf("%f\n",*q)){!sscanf(s,"%lf",q+1)?b=*q--,*q=*s-47?*s-42?*s-45?*q+b:*q-b:*q*b:*q/b:*++q;}}
| ^~~~
main.c: In function 'main':
main.c:1:34: error: 'a' undeclared (first use in this function)
1 | char s[];main(){double*q,b;for(q=a+9;~scanf("%s",s);getchar()<14&&printf("%f\n",*q)){!sscanf(s,"%lf",q+1)?b=*q--,*q=*s-47?*s-42?*s-45?*q+b:*q-b:*q*b:*q/b:*++q;}}
| ^
main.c:1:34: note: each undeclared identifier is reported only once for each function it appears in
main.c:1:39: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | char s[];main(){double*q,b;for(q=a+9;~scanf("%s",s);getchar()<14&&printf("%f\n",*q)){!sscanf(s,"%lf",q+1)?b=*q--,*q=*s-47?*s-42?*s-45?*q+b:*q-b:*q*b:*q/b:*++q;}}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | char s[];main(){double*q,b;for(q=a+9;~scanf("%s",s);getchar()<14&&printf("%f\n",*q)){!sscanf(s,"%lf",q+1)?b=*q--,*q=*s-47?*s-42?*s-45?*q+b:*q-b:*q*b:*q/b:*++q;}}
main.c:1:39: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | char s[];main(){double*q,b;for(q=a+9;~scanf("%s",s);getchar()<14&&printf("%f\n",*q)){!sscanf(s,"%lf",q+1)?b=*q--,*q=*s-47?*s-42?*s-45?*q+b:*q-b:*q*b:*q/b:*++q;}}
| ^~~~~
main.c:1:39: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:53: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
1 | char s[];main(){double*q,b;for(q=a+9;~scanf("%s",s);getchar()<14&&printf("%f\n",*q)){!sscanf(s,"%lf",q+1)?b=*q--,*q=*s-47?*s-42?*s-45?*q+b:*q-b:*q*b:*q/b:*++q;}}
| ^~~~~~~
main.c:1:53: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:1:67: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | char s[];main(){double*q,b;for(q=a+9;~scanf("%s",s);getchar()<14&&printf("%f\n",*q)){!sscanf(s,"%lf",q+1)?b=*q--,*q=*s-47?*s-42?*s-45?*q+b:*q-b:*q*b:*q/b:*++q;}}
| ^~~~~~
main.c:1:67: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:67: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:67: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:87: error: implicit declaration of function 'sscanf' [-Wimplicit-function-declaration]
1 | char s[];main(){double*q,b;for(q=a+9;~scanf("%s",s);getchar()<14&&printf("%f\n",*q)){!sscanf(s,"%lf",q+1)?b=*q--,*q=*s-47?*s-42?*s-45?*q+b:*q-b:*q*b:*q/b:*++q;}}
| ^~~~~~
main.c:1:87: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:1:87: warning: incompatible implicit declaration of built-in function 'sscanf' [-Wbuiltin-declaration-mismatch]
main.c:1:87: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c: At top level:
main.c:1:6: warning: array 's' assumed to have one element
1 | char s[];main(){double*q,b;for(q=a+9;~scanf("%s",s);getchar()<14&&printf("%f\n",*q)){!sscanf(s,"%lf",q+1)?b=*q--,*q=*s-47?*s-42?*s-45?*q+b:*q-b:*q*b:*q/b:*++q;}}
| ^
|
s349368159 | p00087 | C | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;} | main.c:1:10: error: return type defaults to 'int' [-Wimplicit-int]
1 | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;}
| ^~~~
main.c: In function 'main':
main.c:1:26: error: initialization of 'double *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
1 | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;}
| ^
main.c:1:36: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;}
main.c:1:36: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;}
| ^~~~~
main.c:1:36: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:50: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
1 | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;}
| ^~~~~~~
main.c:1:50: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:1:64: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;}
| ^~~~~~
main.c:1:64: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:64: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:64: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:83: error: implicit declaration of function 'sscanf' [-Wimplicit-function-declaration]
1 | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;}
| ^~~~~~
main.c:1:83: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:1:83: warning: incompatible implicit declaration of built-in function 'sscanf' [-Wbuiltin-declaration-mismatch]
main.c:1:83: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:1:149: error: expected ':' before ';' token
1 | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;}
| ^
| :
main.c: At top level:
main.c:1:6: warning: array 's' assumed to have one element
1 | char s[];main(){double*q=s,b;for(;~scanf("%s",s);getchar()<14&&printf("%f\n",*q))!sscanf(s,"%lf",q+1)?b=*q--,*q=*s&1?*q*b:*s>46?*q/b:*s>44?*q-b:*q+b;}
| ^
|
s593809632 | p00087 | C | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;} | main.c:1:1: warning: data definition has no type or storage class
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^~~~
main.c: In function 'main':
main.c:1:7: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:24: error: initialization of 'double *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^
main.c:1:34: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
main.c:1:34: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^~~~~
main.c:1:34: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:58: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^~~~~~
main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:58: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:76: error: implicit declaration of function 'sscanf' [-Wimplicit-function-declaration]
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^~~~~~
main.c:1:76: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:1:76: warning: incompatible implicit declaration of built-in function 'sscanf' [-Wbuiltin-declaration-mismatch]
main.c:1:76: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:1:83: error: passing argument 1 of 'sscanf' from incompatible pointer type [-Wincompatible-pointer-types]
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^
| |
| int *
main.c:1:83: note: expected 'const char *' but argument is of type 'int *'
main.c:1:136: error: invalid type argument of unary '*' (have 'int')
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^~
main.c: At top level:
main.c:1:3: warning: array 's' assumed to have one element
1 | a,s[];main(c){double*q=s,b;for(;~scanf("%s%c",s,&c);c&2&&printf("%f\n",*q))sscanf(s,"%lf",q+1)-1?a=*s&7,b=*q--,*q=a-7?a-2?*q+=a-5?b:-b:*a*b:*q/b:*++q;}
| ^
|
s355800132 | p00087 | C | s;main(c){for(double*q=&s,b;~scanf("%s%c",&s,&c);c&2&&printf("%f\n",*q))sscanf(&s,"%lf",q+1)-1?b=*q--,*q=s&1?s&2?s&4?*q/b:*q+b:*q-b:*q*b:*++q;} | main.c:1:1: warning: data definition has no type or storage class
1 | s;main(c){for(double*q=&s,b;~scanf("%s%c",&s,&c);c&2&&printf("%f\n",*q))sscanf(&s,"%lf",q+1)-1?b=*q--,*q=s&1?s&2?s&4?*q/b:*q+b:*q-b:*q*b:*++q;}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
main.c:1:3: error: return type defaults to 'int' [-Wimplicit-int]
1 | s;main(c){for(double*q=&s,b;~scanf("%s%c",&s,&c);c&2&&printf("%f\n",*q))sscanf(&s,"%lf",q+1)-1?b=*q--,*q=s&1?s&2?s&4?*q/b:*q+b:*q-b:*q*b:*++q;}
| ^~~~
main.c: In function 'main':
main.c:1:3: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:24: error: initialization of 'double *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
1 | s;main(c){for(double*q=&s,b;~scanf("%s%c",&s,&c);c&2&&printf("%f\n",*q))sscanf(&s,"%lf",q+1)-1?b=*q--,*q=s&1?s&2?s&4?*q/b:*q+b:*q-b:*q*b:*++q;}
| ^
main.c:1:30: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | s;main(c){for(double*q=&s,b;~scanf("%s%c",&s,&c);c&2&&printf("%f\n",*q))sscanf(&s,"%lf",q+1)-1?b=*q--,*q=s&1?s&2?s&4?*q/b:*q+b:*q-b:*q*b:*++q;}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | s;main(c){for(double*q=&s,b;~scanf("%s%c",&s,&c);c&2&&printf("%f\n",*q))sscanf(&s,"%lf",q+1)-1?b=*q--,*q=s&1?s&2?s&4?*q/b:*q+b:*q-b:*q*b:*++q;}
main.c:1:30: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | s;main(c){for(double*q=&s,b;~scanf("%s%c",&s,&c);c&2&&printf("%f\n",*q))sscanf(&s,"%lf",q+1)-1?b=*q--,*q=s&1?s&2?s&4?*q/b:*q+b:*q-b:*q*b:*++q;}
| ^~~~~
main.c:1:30: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:55: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | s;main(c){for(double*q=&s,b;~scanf("%s%c",&s,&c);c&2&&printf("%f\n",*q))sscanf(&s,"%lf",q+1)-1?b=*q--,*q=s&1?s&2?s&4?*q/b:*q+b:*q-b:*q*b:*++q;}
| ^~~~~~
main.c:1:55: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:55: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:55: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:73: error: implicit declaration of function 'sscanf' [-Wimplicit-function-declaration]
1 | s;main(c){for(double*q=&s,b;~scanf("%s%c",&s,&c);c&2&&printf("%f\n",*q))sscanf(&s,"%lf",q+1)-1?b=*q--,*q=s&1?s&2?s&4?*q/b:*q+b:*q-b:*q*b:*++q;}
| ^~~~~~
main.c:1:73: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:1:73: warning: incompatible implicit declaration of built-in function 'sscanf' [-Wbuiltin-declaration-mismatch]
main.c:1:73: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:1:80: error: passing argument 1 of 'sscanf' from incompatible pointer type [-Wincompatible-pointer-types]
1 | s;main(c){for(double*q=&s,b;~scanf("%s%c",&s,&c);c&2&&printf("%f\n",*q))sscanf(&s,"%lf",q+1)-1?b=*q--,*q=s&1?s&2?s&4?*q/b:*q+b:*q-b:*q*b:*++q;}
| ^~
| |
| int *
main.c:1:80: note: expected 'const char *' but argument is of type 'int *'
|
s606382351 | p00087 | C | #include<stdio.h>
#include<stdlib.h>
#include<string>
int main()
{
char c,d[11];
double s[80];
int p=-1,q=0,t;
while(scanf("%c",&c)!=EOF)
{
switch(c)
{
case '+':
t=s[p-1]+s[p];
goto j;
case '-':
scanf("%c",&c);
if('1'>c||'0'<c)
{
t=s[p-1]-s[p];
goto j;
}
if(c=='\n')
goto k;
d[q++]='-';
d[q++]=c;
break;
case '*':
t=s[p-1]*s[p];
goto j;
case '/':
t=s[p-1]/s[p];
j: s[--p]=t;
break;
case '\n':
if(d[0]!=0)
s[0]=atof(d);
printf("%lf\n",s[0]);
p=-1;
q=0;
break;
case ' ':
k: if(q!=0)
{
s[++p]=atof(d);
memset(d,NULL,11);
q=0;
}
break;
default:
d[q++]=c;
}
}
return 0;
} | main.c:3:9: fatal error: string: No such file or directory
3 | #include<string>
| ^~~~~~~~
compilation terminated.
|
s631584817 | p00087 | C++ | #include <cstdio>
#include <stack>
#include <cctype>
#include <cstring>
using namespace std;
double eval(double a, double b, char oper){
if( oper == '+' ) return a+b;
if( oper == '-' ) return a-b;
if( oper == '*' ) return a*b;
if( oper == '/' ) return a/b;
return 0;
}
int main(){
char expr[100];
char* it;
while( fgets(expr, 100, stdin) ){
stack<double> stk;
double ans = 0;
it = strtok(expr, " ");
stk.push( atoi(it) );
while( true ){
it = strtok(NULL, " ");
if( it == NULL ) break;
if( isdigit( *it ) ){
stk.push( atoi(it) );
}else{
int a, b;
a = stk.top();
stk.pop();
b = stk.top();
stk.pop();
stk.push( eval(b, a, *it) );
}
}
printf("%lf\n", stk.top() );
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:19: error: 'atoi' was not declared in this scope
22 | stk.push( atoi(it) );
| ^~~~
|
s776515331 | p00087 | C++ | #include <cstdio>
#include <stack>
#include <cctype>
#include <cstring>
using namespace std;
double eval(double a, double b, char oper){
if( oper == '+' ) return a+b;
if( oper == '-' ) return a-b;
if( oper == '*' ) return a*b;
if( oper == '/' ) return a/b;
return 0;
}
int main(){
char expr[100];
char* it;
while( fgets(expr, 100, stdin) ){
stack<double> stk;
double ans = 0;
it = strtok(expr, " ");
stk.push( atoi(it) );
while( true ){
it = strtok(NULL, " ");
if( it == NULL ) break;
if( isdigit( *it ) ){
stk.push( atoi(it) );
}else{
int a, b;
a = stk.top();
stk.pop();
b = stk.top();
stk.pop();
stk.push( eval(b, a, *it) );
}
}
printf("%lf\n", stk.top() );
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:19: error: 'atoi' was not declared in this scope
22 | stk.push( atoi(it) );
| ^~~~
|
s586511944 | p00087 | C++ | #include <cstdio>
#include <stack>
#include <cctype>
#include <cstring>
using namespace std;
double eval(double a, double b, char oper){
if( oper == '+' ) return a+b;
if( oper == '-' ) return a-b;
if( oper == '*' ) return a*b;
if( oper == '/' ) return a/b;
return 0;
}
int main(){
char expr[100];
char* it;
while( fgets(expr, 100, stdin) ){
stack<double> stk;
it = strtok(expr, " ");
stk.push( atoi(it) );
while( true ){
it = strtok(NULL, " ");
if( it == NULL ) break;
if( isdigit( *it ) ){
stk.push( atoi(it) );
}else{
int a, b;
a = stk.top();
stk.pop();
b = stk.top();
stk.pop();
stk.push( eval(b, a, *it) );
}
}
printf("%lf\n", stk.top() );
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:19: error: 'atoi' was not declared in this scope
21 | stk.push( atoi(it) );
| ^~~~
|
s471538350 | p00087 | C++ | #include <cstdio>
#include <stack>
#include <cctype>
#include <cstring>
using namespace std;
double eval(double a, double b, char oper){
if( oper == '+' ) return a+b;
if( oper == '-' ) return a-b;
if( oper == '*' ) return a*b;
if( oper == '/' ) return a/b;
return 0;
}
int main(){
char expr[100];
char* it;
while( fgets(expr, 100, stdin) ){
stack<double> stk;
it = strtok(expr, " ");
stk.push( (double)atoi(it) );
while( true ){
it = strtok(NULL, " ");
if( it == NULL ) break;
if( isdigit( *it ) ){
stk.push( (double)atoi(it) );
}else{
int a, b;
a = stk.top();
stk.pop();
b = stk.top();
stk.pop();
stk.push( eval(b, a, *it) );
}
}
printf("%lf\n", stk.top() );
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:27: error: 'atoi' was not declared in this scope
21 | stk.push( (double)atoi(it) );
| ^~~~
|
s545371509 | p00087 | C++ | #include <cstdio>
#include <cctype>
#include <stdlib>
#include <cstring>
#include <stack>
using namespace std;
double eval(double a, double b, char oper){
if( oper == '+' ) return a + b;
if( oper == '-' ) return a - b;
if( oper == '*' ) return a * b;
if( oper == '/' ) return a / b;
return 0.0;
}
int main(){
char expr[100];
char* it;
while( fgets(expr, 100, stdin) ){
stack<double> stk;
it = strtok(expr, " ");
stk.push( (double)atoi(it) );
while( true ){
it = strtok(NULL, " ");
if( it == NULL ) break;
if( isdigit( *it ) ){
stk.push( (double)atoi(it) );
}else{
int a, b;
a = stk.top();
stk.pop();
b = stk.top();
stk.pop();
stk.push( eval(b, a, *it) );
}
}
printf("%lf\n", stk.top() );
}
return 0;
} | a.cc:3:10: fatal error: stdlib: No such file or directory
3 | #include <stdlib>
| ^~~~~~~~
compilation terminated.
|
s139255035 | p00087 | C++ | #include<iostream>
#include<cstdio>
#include<string>
#include<stack>
using namespace std;
double s_d(string a){
double b=0;
double zy=0.1;
bool hu=false;
bool dot=false;
for(int i=0;i<a.size();i++){
if(dot){
b+=zy*(a[i]-'0');
zy*=0.1;
}
else if(a[i]=='-') hu=true;
else if(a[i]=='.'){
dot=true;
}
else{
b*=10;
b+=a[i]-'0';
}
}
if(hu) b*=-1;
return b;
}
int main(){
stack<string> siki;
stack<double> bnum;
string nums="";
double a,b,c;
char in;
while(cin>>nums){
siki.push(nums);
nums="";
while(1){
in=getchar();
if(in=='*'||in=='-'||in=='/'||in=='+'){
if(siki.top()=="?"){
b=bnum.top();
bnum.pop();
siki.pop();
}
else{
b=s_d(siki.top());
siki.pop();
}
if(siki.top()=="?"){
a=bnum.top();
bnum.pop();
siki.pop();
}
else{
a=s_d(siki.top());
siki.pop();
}
if(in=='*') c=a*b;
else if(in=='+') c=a+b;
else if(in=='-') c=a-b;
else if(in=='/') c=a/b;
siki.push("?");
bnum.push(c);
}
else if(in==' '){
if(!nums.empty()){
siki.push(nums);
nums="";
}
}
else if(in=='\n'){
break;
}
else{
nums+=in;
}
}
} | a.cc: In function 'int main()':
a.cc:85:10: error: expected '}' at end of input
85 | }
| ^
a.cc:32:11: note: to match this '{'
32 | int main(){
| ^
|
s580135934 | p00087 | C++ | #include <iostream>
#include <sstream>
#include <string>
#include <stack>
#include <stdlib.h>
using namespace std;
int main()
{
string s;
while(getline(cin, s))
{
stringstream ss;
ss << s;
stack<double> st;
while(ss >> s)
{
if((s[0] >= '0' && s[0] <= '9') || s.size() > 1)
{
st.push(atoi(s.c_str()));
}
else
{
double a, b, x;
b = st.top();
st.pop();
a = st.top();
st.pop();
if(strcmp(s.c_str(), "+") == 0)
x = a+b;
else if(strcmp(s.c_str(), "-") == 0)
x = a-b;
else if(strcmp(s.c_str(), "/") == 0)
x = a/b;
else if(strcmp(s.c_str(), "*") == 0)
x = a*b;
st.push(x);
}
}
double result = st.top();
cout << result << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:20: error: 'strcmp' was not declared in this scope
29 | if(strcmp(s.c_str(), "+") == 0)
| ^~~~~~
a.cc:6:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <stdlib.h>
+++ |+#include <cstring>
6 | using namespace std;
|
s022300082 | p00087 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<string> data;
vector<string> split(string& str, char delim) {
stringstream ss(str);
vector<string> res;
string tmp;
while(getline(ss, tmp, delim)) res.push_back(tmp);
return(res);
}
double calc(double a, double b, char opr) {
switch(opr) {
case '+':return(a+b);
case '-':return(a-b);
case '*':return(a*b);
case '/':return(a/b);
}
return(-1);
}
double solve() {
stack<double> stk;
for(int r = 0; r < data.size(); r++) {
if(data[r][0] >= '0' && data[r][0] <= '9') { //整数値ならば
stk.push(stoi(data[r]));
} else {
double a = stk.top(); stk.pop();
double b = stk.top(); stk.pop();
stk.push(calc(b, a, data[r][0]));
}
}
return(stk.top());
}
int main(void) {
string operation;
while(getline(cin, operation)) {
data = split(operation, ' ');
printf("%.6f\n", solve());
}
return(0);
} | a.cc: In function 'double solve()':
a.cc:25:24: error: reference to 'data' is ambiguous
25 | for(int r = 0; r < data.size(); r++) {
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:3:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
3 | vector<string> data;
| ^~~~
a.cc:26:12: error: reference to 'data' is ambiguous
26 | if(data[r][0] >= '0' && data[r][0] <= '9') { //整数値ならば
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:3:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
3 | vector<string> data;
| ^~~~
a.cc:26:33: error: reference to 'data' is ambiguous
26 | if(data[r][0] >= '0' && data[r][0] <= '9') { //整数値ならば
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:3:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
3 | vector<string> data;
| ^~~~
a.cc:27:27: error: reference to 'data' is ambiguous
27 | stk.push(stoi(data[r]));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:3:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
3 | vector<string> data;
| ^~~~
a.cc:31:33: error: reference to 'data' is ambiguous
31 | stk.push(calc(b, a, data[r][0]));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:3:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
3 | vector<string> data;
| ^~~~
a.cc: In function 'int main()':
a.cc:40:9: error: reference to 'data' is ambiguous
40 | data = split(operation, ' ');
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:3:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
3 | vector<string> data;
| ^~~~
|
s210708954 | p00087 | C++ | #include <bits/stdc++.h>
#include <string>
#include <typeinfo>
using namespace std;
vector<string> data;
vector<string> split(string& str, char delim) {
stringstream ss(str);
vector<string> res;
string tmp;
while(getline(ss, tmp, delim)) res.push_back(tmp);
return(res);
}
double calc(double a, double b, char opr) {
switch(opr) {
case '+':return(a+b);
case '-':return(a-b);
case '*':return(a*b);
case '/':return(a/b);
}
return(-1);
}
double solve() {
stack<double> stk;
for(int r = 0; r < data.size(); r++) {
if(data[r][0] >= '0' && data[r][0] <= '9') { //整数値ならば
stk.push(stoi(data[r]));
} else {
double a = stk.top(); stk.pop();
double b = stk.top(); stk.pop();
stk.push(calc(b, a, data[r][0]));
}
}
return(stk.top());
}
int main(void) {
string operation;
while(getline(cin, operation)) {
data = split(operation, ' ');
printf("%.6f\n", solve());
}
return(0);
} | a.cc: In function 'double solve()':
a.cc:27:24: error: reference to 'data' is ambiguous
27 | for(int r = 0; r < data.size(); r++) {
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:5:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
5 | vector<string> data;
| ^~~~
a.cc:28:12: error: reference to 'data' is ambiguous
28 | if(data[r][0] >= '0' && data[r][0] <= '9') { //整数値ならば
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:5:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
5 | vector<string> data;
| ^~~~
a.cc:28:33: error: reference to 'data' is ambiguous
28 | if(data[r][0] >= '0' && data[r][0] <= '9') { //整数値ならば
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:5:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
5 | vector<string> data;
| ^~~~
a.cc:29:27: error: reference to 'data' is ambiguous
29 | stk.push(stoi(data[r]));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:5:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
5 | vector<string> data;
| ^~~~
a.cc:33:33: error: reference to 'data' is ambiguous
33 | stk.push(calc(b, a, data[r][0]));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:5:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
5 | vector<string> data;
| ^~~~
a.cc: In function 'int main()':
a.cc:42:9: error: reference to 'data' is ambiguous
42 | data = split(operation, ' ');
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:5:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
5 | vector<string> data;
| ^~~~
|
s725007851 | p00087 | C++ | #include<iostream>
#include<cstdlib>
#include<stack>
#include<string>
#include<cctype>
#include<sstream>
using namespace std;
int main(){
string str;
while(getline(cin,s)){
stack<double>S;
stringstream ss
ss<<s;
while(ss>>s){
if(isdigit(str[0])){
double d=(double)atoi(str.c_str());
S.push(d);
}
else{
char ope=str[0];
int d1=S.top();S.pop();
int d2=S.top();S.pop();
if(ope=='+')S.push(d1+d2);
else if(ope=='-')S.push(d2-d1);
else if(ope=='*')S.push(d1*d2);
else S.push(d2/d1);
}
}
cout<<fixed<<S.top()<<endl;
}
} | a.cc: In function 'int main()':
a.cc:10:23: error: 's' was not declared in this scope
10 | while(getline(cin,s)){
| ^
a.cc:13:9: error: expected initializer before 'ss'
13 | ss<<s;
| ^~
a.cc:14:15: error: 'ss' was not declared in this scope
14 | while(ss>>s){
| ^~
|
s457631906 | p00087 | C++ | #include <iostream>
#include <cstdio>
#include <stack>
#include <string>
#include <cstdlib>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
char str[80+4];
while(gets(str) != NULL) {
stack<double> s;
string t;
int len = strlen(str);
rep(i,len) {
if(str[i] == ' ') {
if(isdigit(t[0])) {
double n = atof(t.c_str());
s.push(n);
} else {
if(t == "+") {
double a = s.top(); s.pop();
double b = s.top(); s.pop();
double c = a + b;
s.push(c);
}
if(t == "-") {
double a = s.top(); s.pop();
double b = s.top(); s.pop();
double c = b - a;
s.push(c);
}
if(t == "*") {
double a = s.top(); s.pop();
double b = s.top(); s.pop();
double c = a * b;
s.push(c);
}
if(t == "/") {
double a = s.top(); s.pop();
double b = s.top(); s.pop();
double c = b / a;
s.push(c);
}
}
t = "";
} else {
t += str[i];
}
}
double a = s.top(); s.pop();
double b = s.top(); s.pop();
if(t == "+") printf("%.6lf\n", a + b);
else if(t == "-") printf("%.6lf\n", b - a);
else if(t == "*") printf("%.6lf\n", a * b);
else printf("%.6lf\n", b / a);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
11 | while(gets(str) != NULL) {
| ^~~~
| getw
a.cc:14:27: error: 'strlen' was not declared in this scope
14 | int len = strlen(str);
| ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <cstdlib>
+++ |+#include <cstring>
6 | using namespace std;
|
s063334093 | p00087 | C++ | #include <iostream>
#include <cstdio>
#include <stack>
#include <string>
#include <cstdlib>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
char str[80+4];
while(gets(str) != NULL) {
stack<double> s;
string t;
int len = strlen(str);
if(len == 0) break;
rep(i,len) {
if(str[i] == ' ') {
if(isdigit(t[0])) {
double n = atof(t.c_str());
s.push(n);
} else {
double a = s.top(); s.pop();
double b = s.top(); s.pop();
double c;
if(t == "+") c = a + b;
else if(t == "-") c = b - a;
else if(t == "*") c = a * b;
else c = b / a;
s.push(c);
}
t = "";
} else {
t += str[i];
}
}
double a = s.top(); s.pop();
double b = s.top(); s.pop();
if(t == "+") printf("%.6lf\n", a + b);
else if(t == "-") printf("%.6lf\n", b - a);
else if(t == "*") printf("%.6lf\n", a * b);
else printf("%.6lf\n", b / a);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
11 | while(gets(str) != NULL) {
| ^~~~
| getw
a.cc:14:27: error: 'strlen' was not declared in this scope
14 | int len = strlen(str);
| ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <cstdlib>
+++ |+#include <cstring>
6 | using namespace std;
|
s031186272 | p00087 | C++ | #include <iostream>
#include <cstdio>
#include <stack>
#include <string>
#include <cstring>
#include <sstream>
#include <cstdlib>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
string str;
while(getline(cin, str)) {
stack<double> s;
stringstream ss;
ss << str;
while(ss >> str) {
if(s[0] >= '0' && s[0] <= '9' || s.size() > 1) {
s.push(atoi(str.c_str()));
} else {
double a = s.top(); s.pop();
double b = s.top(); s.pop();
double c;
if(str[0] == '+') c = a + b;
else if(str[0] == '-') c = b - a;
else if(str[0] == '*') c = a * b;
else c = b / a;
s.push(c);
}
}
printf("%.6lf\n", s.top());
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:29: error: no match for 'operator[]' (operand types are 'std::stack<double>' and 'int')
18 | if(s[0] >= '0' && s[0] <= '9' || s.size() > 1) {
| ^
a.cc:18:44: error: no match for 'operator[]' (operand types are 'std::stack<double>' and 'int')
18 | if(s[0] >= '0' && s[0] <= '9' || s.size() > 1) {
| ^
|
s233212451 | p00087 | C++ | //Strange Mathematical Expression
#include<bits/stdc++.h>
using namespace std;
stack<double> st;
double stoi(string s){
double ret=0;
bool flag=true;
int n;
for(int i=0; i<s.length(); i++)
if(s[i]=='.'){flag=false; n=i; while(true); continue;}
if(flag){ret=ret*10+(s[i]-'0');}
else{ret+=(s[i]-'0')*pow(10.0, -(n-i));}
return ret;
}
int main(){
string s;
while(getline(cin, s)){
stringstream ss(s);
string t;
while(getline(ss, t, ' ')){
if(t=="+"){
double c1=st.top(); st.pop();
double c2=st.top(); st.pop();
st.push(c1+c2);
}
else if(t=="-"){
double c1=st.top(); st.pop();
double c2=st.top(); st.pop();
st.push(c2-c1);
}
else if(t=="*"){
double c1=st.top(); st.pop();
double c2=st.top(); st.pop();
st.push(c1*c2);
}
else if(t=="/"){
double c1=st.top(); st.pop();
double c2=st.top(); st.pop();
st.push(c2/c1);
}
else{
st.push(stoi(t));
}
}
printf("%.8f\n", st.top());
while(!st.empty())st.pop();
}
return 0;
} | a.cc: In function 'double stoi(std::string)':
a.cc:13:28: error: 'i' was not declared in this scope
13 | if(flag){ret=ret*10+(s[i]-'0');}
| ^
a.cc:14:18: error: 'i' was not declared in this scope
14 | else{ret+=(s[i]-'0')*pow(10.0, -(n-i));}
| ^
a.cc: In function 'int main()':
a.cc:45:21: error: call of overloaded 'stoi(std::string&)' is ambiguous
45 | st.push(stoi(t));
| ~~~~^~~
a.cc:7:8: note: candidate: 'double stoi(std::string)'
7 | double stoi(string s){
| ^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:2:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
|
s634857931 | p00087 | C++ | 10 2 12 - /
3 4 - 7 2 3 * + *
1 5 + 2 3 + *
2 3 /
6 0 / | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 10 2 12 - /
| ^~
|
s368271128 | p00087 | C++ | while s=gets
a=s.chomp.split ' '
ls = []
for i in 0...a.length
c = a[i]
if c=="+" || c=="-" || c=="*" || c=="/"
x=ls.pop
y=ls.pop
if c=="+"
ls.push y+x
elsif c=="-"
ls.push y-x
elsif c=="*"
ls.push y*x
elsif c=="/"
ls.push y/x
end
else
ls.push c.to_f
end
end
puts sprintf("%.9f",ls[0])
end | a.cc:4:12: error: too many decimal points in number
4 | for i in 0...a.length
| ^~~~~~~~~~~~
a.cc:1:1: error: expected unqualified-id before 'while'
1 | while s=gets
| ^~~~~
|
s329425014 | p00087 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
string str;
while(getline(cin,str)){
stack<double> st;
for(int i=0,point=0;;i++){
if(str[i]==' '||str[i]=='\0'){
int num[2]={};
if(i-point==1){
if(str[point]-'0'>9||str[point]-'0'<0){
double righ=st.top();
st.pop();
double lef=st.top();
st.pop();
if(str[point]=='+')st.push(lef+righ);
else if(str[point]=='-')st.push(lef-righ);
else if(str[point]=='*')st.push(lef*righ);
else st.push(lef/righ);
}
else st.push(str[point]-'0');
}
else if(i-point==2){
if(str[point]=='-')st.push(-1*(str[i-1]-'0'));
else st.push((str[point]-'0')*10+(str[i-1]-'0'));
}
else st.push(-1*((str[i-2]-'0')*10+(str[i-1]-'0')))
if(str[i]=='\0')break;
point=i+1;
}
}
if(!st.size())cout<<str<<endl;
else printf("%lf\n",st.top());
}
} | a.cc: In function 'int main()':
a.cc:28:68: error: expected ';' before 'if'
28 | else st.push(-1*((str[i-2]-'0')*10+(str[i-1]-'0')))
| ^
| ;
29 | if(str[i]=='\0')break;
| ~~
|
s712625798 | p00087 | C++ | define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
queue<string> split(string delim,string str){
queue<string> res;
str += delim;
for(int i=0;i<str.size();i++){
for(int j=1;i+j<=str.size();j++){
if(str.substr(i,j).find(delim) != string::npos){
//cout << str.substr(i,j) << endl;
if(str.substr(i,j-1).size() > 0 ) res.push(str.substr(i,j-1));
i+=j-1;
break;
}
}
}
return res;
}
int main(){
string str;
while(getline(cin,str)){
stack<double> stk;
queue<string> res = split(" ",str);
while(!res.empty()){
string now = res.front();
res.pop();
if(now == "+"){
double a = stk.top();
stk.pop();
double b = stk.top();
stk.pop();
stk.push(b+a);
}
else if(now == "/"){
double a = stk.top();
stk.pop();
double b = stk.top();
stk.pop();
stk.push(b/a);
}
else if(now == "*"){
double a = stk.top();
stk.pop();
double b = stk.top();
stk.pop();
stk.push(b*a);
}
else if(now == "-"){
double a = stk.top();
stk.pop();
double b = stk.top();
stk.pop();
stk.push(b-a);
}
else{
double num;
sscanf(now.c_str(),"%lf",&num);
stk.push(num);
}
}
printf("%.6f\n",stk.top());
}
} | a.cc:1:1: error: 'define' does not name a type
1 | define _USE_MATH_DEFINES
| ^~~~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
179 | _GLI |
s864379365 | p00087 | C++ | define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
queue<string> split(string delim,string str){
queue<string> res;
str += delim;
for(int i=0;i<str.size();i++){
for(int j=1;i+j<=str.size();j++){
if(str.substr(i,j).find(delim) != string::npos){
//cout << str.substr(i,j) << endl;
if(str.substr(i,j-1).size() > 0 ) res.push(str.substr(i,j-1));
i+=j-1;
break;
}
}
}
return res;
}
int main(){
string str;
while(getline(cin,str)){
stack<double> stk;
queue<string> res = split(" ",str);
while(!res.empty()){
string now = res.front();
res.pop();
if(now == "+"){
double a = stk.top();
stk.pop();
double b = stk.top();
stk.pop();
stk.push(b+a);
}
else if(now == "/"){
double a = stk.top();
stk.pop();
double b = stk.top();
stk.pop();
stk.push(b/a);
}
else if(now == "*"){
double a = stk.top();
stk.pop();
double b = stk.top();
stk.pop();
stk.push(b*a);
}
else if(now == "-"){
double a = stk.top();
stk.pop();
double b = stk.top();
stk.pop();
stk.push(b-a);
}
else{
double num;
sscanf(now.c_str(),"%lf",&num);
stk.push(num);
}
}
printf("%.6f\n",stk.top());
}
} | a.cc:1:1: error: 'define' does not name a type
1 | define _USE_MATH_DEFINES
| ^~~~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
179 | _GLI |
s858182986 | p00087 | C++ | #include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;
#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define sc(x) cin >> x
#define sc2(x, y) cin >> x >> y
#define sc3(x, y, z) cin >> x >> y >> z
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.6lf\n", x)
signed main(void){
int i, j, k;
for(int testcase = 0;testcase < 1234567;testcase++){
string s;
if(getline(cin, s) == EOF)break;
s += " ";
int head = 0;
double stc[800] = {0.0};
for(i = 0;i < s.size();++i){
if(s[i] == ' ')continue;
else if(s[i] == '+'){
head--;
stc[head - 1] = stc[head - 1] + stc[head];
i++;
}else if(s[i] == '-'){
head--;
stc[head - 1] = stc[head - 1] - stc[head];
i++;
}else if(s[i] == '*'){
head--;
stc[head - 1] = stc[head - 1] * stc[head];
i++;
}else if(s[i] == '/'){
head--;
stc[head - 1] = stc[head - 1] / stc[head];
i++;
}else{
double sum = 0.0;
for(;i < s.size();i++){
if(s[i] == ' ')break;
sum *= 10.0;
sum += (double)(s[i] - '0');
}
stc[head++] = sum;
}
debug(head);
rep(j, head)cout << "h" << j << " " << stc[j] << endl;
}
prid(stc[0]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:70:24: error: no match for 'operator==' (operand types are 'std::basic_istream<char>' and 'int')
70 | if(getline(cin, s) == EOF)break;
| ~~~~~~~~~~~~~~~ ^~
| |
| std::basic_istream<char>
a.cc:70:24: note: candidate: 'operator==(int, int)' (built-in)
70 | if(getline(cin, s) == EOF)break;
| ^
a.cc:70:24: note: no known conversion for argument 1 from 'std::basic_istream<char>' to 'int'
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/cstdio:42,
from /usr/include/c++/14/ext/string_conversions.h:45,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'const std::fpos<_StateT>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'const std::allocator<_CharT>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'const std::pair<_T1, _T2>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
70 | if(getline(cin, s) == EOF)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:70:27: note: 'std::basic_istream<char>' is not derived from 'const std::tuple<_UTypes ...>'
70 | if(getline(cin, s) == EOF)break;
| ^~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: te |
s444715974 | p00087 | C++ | #include <iostream>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <iomanip>
using namespace std;
double S[1000];
int f=0;
void push(double num){
S[f]=num;
f++;
}
double pop(){
f--;
double a=S[f];
return a;
}
int main(){
double num1,num2;
char a[100],str[100];
while(gets(a)!=EOF){
f=0;
for(int i=0,j=0;a[i]!='\0';i++){
//cout << j<<endl;
if((a[i]=='+'||a[i]=='-'||a[i]=='*'||a[i]=='/')&&(a[i+1]==' '||a[i+1]=='\0')){
num1=pop();
num2=pop();
switch(a[i]){
case '+':
push(num2+num1);
break;
case '-':
push(num2-num1);
break;
case '*':
push(num2*num1);
break;
case '/':
push(num2/num1);
break;
}
//num1=pop();
//cout<<num1<<endl;
//push(num1);
i++;
continue;
}
if(a[i]==' '||a[i]=='\0'){
str[j]='\0';
j=0;
//printf("%s\n",str);
push(atof(str));
if(a[i]=='\0'){
break;
}
}
str[j]=a[i];j++;
}
cout<< fixed << setprecision(6) << pop()<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
25 | while(gets(a)!=EOF){
| ^~~~
| getw
|
s493227577 | p00087 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
double a, b;
string str;
vector<double> st;
while (cin >> str) {
if (str == "+") {
b = st.back(); st.pop_back();
a = st.back(); st.pop_back();
st.push_back(a + b);
}
else if (str == "-") {
b = st.back(); st.pop_back();
a = st.back(); st.pop_back();
st.push_back(a - b);
}
else if (str == "*") {
b = st.back(); st.pop_back();
a = st.back(); st.pop_back();
st.push_back(a * b);
}
else if (str == "/") {
b = st.back(); st.pop_back();
a = st.back(); st.pop_back();
st.push_back(a / b);
}
else
st.push_back(stof(str));
}
while (st.size()) {
cout << fixed << setprecision(6) << st.pop_back());
st.pop_back();
}
return 0;
} | a.cc: In function 'int main()':
a.cc:35:50: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and 'void')
35 | cout << fixed << setprecision(6) << st.pop_back());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~~~~~~~~~~
| | |
| std::basic_ostream<char> void
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'void' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'void' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'void' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'void' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'void' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'void' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'void' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'void' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'void' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'void' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'void' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'void' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'void' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'void' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'void' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'void' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | operator<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'void' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
| ^~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:124:5: note: candidate: 'std::basic_ostream<_CharT, _Traits |
s687111069 | p00087 | C++ | import sys
def line():return sys.stdin.readline().strip()
ops = {"+":lambda a,b:b + a,
"-":lambda a,b:b - a,
"*":lambda a,b:b * a,
"/":lambda a,b:b / a}
while True:
try:
stack = []
for s in line().split():
if s in ops:
stack.append(ops[s](stack.pop(),stack.pop()))
else:
stack.append(int(s))
print(stack[0])
except:
break | 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:8:1: error: expected unqualified-id before 'while'
8 | while True:
| ^~~~~
|
s473712643 | p00087 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
char s[100];
char buf[100];
int main() {
while (gets_s(buf)) {
stack<double>st;
char*S = buf;
while (S < buf + strlen(buf)) {
sscanf(S, "%s", s);
if (s[0] == '+') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b + a);
}
else if (s[0] == '-') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b - a);
}
else if (s[0] == '*') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b*a);
}
else if (s[0] == '/') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b / a);
}
else {
st.push(atof(s));
}
S += strlen(s) + 1;
}
printf("%.6lf\n", st.top());
}
} | a.cc: In function 'int main()':
a.cc:10:16: error: 'gets_s' was not declared in this scope; did you mean 'getsid'?
10 | while (gets_s(buf)) {
| ^~~~~~
| getsid
|
s828263936 | p00087 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
char s[100];
char buf[100];
int main() {
while (gets(buf)) {
stack<double>st;
char*S = buf;
while (S < buf + strlen(buf)) {
sscanf(S, "%s", s);
if (s[0] == '+') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b + a);
}
else if (s[0] == '-') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b - a);
}
else if (s[0] == '*') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b*a);
}
else if (s[0] == '/') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b / a);
}
else {
st.push(atof(s));
}
S += strlen(s) + 1;
}
printf("%.6lf\n", st.top());
}
} | a.cc: In function 'int main()':
a.cc:10:16: error: 'gets' was not declared in this scope; did you mean 'getw'?
10 | while (gets(buf)) {
| ^~~~
| getw
|
s291555458 | p00087 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
char s[100];
char buf[100];
int main() {
while (gets_s(buf)) {
stack<double>st;
char*S = buf;
while (S < buf + strlen(buf)) {
sscanf(S, "%s", s);
if (s[0] == '+') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b + a);
}
else if (s[0] == '-') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b - a);
}
else if (s[0] == '*') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b*a);
}
else if (s[0] == '/') {
double a = st.top(); st.pop();
double b = st.top(); st.pop();
st.push(b / a);
}
else {
st.push(atof(s));
}
S += strlen(s) + 1;
}
printf("%.6lf\n", st.top());
}
} | a.cc: In function 'int main()':
a.cc:10:16: error: 'gets_s' was not declared in this scope; did you mean 'getsid'?
10 | while (gets_s(buf)) {
| ^~~~~~
| getsid
|
s762976205 | p00087 | C++ | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<stack>
#include<cstring>
#include<string>
#include<sstream>
using namespace std;
int main()
{
string s;
while (getline(cin, s)) {
if (cin.eof())break;//if(s=="")break;
stack<double> st;
stringstream ss(s);
string tmp;
while (ss >> tmp) {
if (tmp == "+" || tmp == "-" || tmp == "*" || tmp == "/") {//???????¨?????????\????????£??????
if (st.empty())break;//?????????????????????????????£????????????
double z1 = st.top();
st.pop();//stack?????????????????????
double z2 = st.top();
st.pop();//stack?????????????????????
double z3 = 0.0;
if (tmp == "+")z3 = z2 + z1;
else if (tmp == "-")z3 = z2 - z1;
else if (tmp == "*")z3 = z2 * z1;
else if (tmp == "/")z3 = z2 / z1;
st.push(z3);
}
else {//??°????????\????????£??????
st.push(atof(tmp));//double?????????????????????????????\??????
}
}
printf("%.6f\n", st.top());
}
return 0;
} | a.cc: In function 'int main()':
a.cc:34:46: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
34 | st.push(atof(tmp));//double?????????????????????????????\??????
| ^~~
| |
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdlib.h:102:33: note: initializing argument 1 of 'double atof(const char*)'
102 | extern double atof (const char *__nptr)
| ~~~~~~~~~~~~^~~~~~
|
s085314561 | p00087 | C++ | #include<iostream>
#include<stdio.h>
#include<string>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<string.h>
#include<cctype>
#include<map>
#include<set>
#include<vector>
#include<sstream>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<list>
using namespace std;
int stringToint(const string S)
{
int result=0;
if(S[0]=='-')
{
for(int i=1;i<S.length();i++)
{
result=10*result+(S[i]-'0');
}
result=-result;
}
else
{
for(int i=0;i<S.length();i++)
{
result=10*result+(S[i]-'0');
}
}
return result;
}
int main()
{
string s;
string word;
while(getline(cin,s)!=EOF)
{
stack<double> mm;
for(int i=0;i<s.length();i++)
{
word="";
while((i<s.length())&&(!isspace(s[i])))
{
word+=s[i];
i++;
}
if((word.length()==2&&word[0]=='-')||(isdigit(word[0])))
{
double kk=1.0*(stringToint(word));
mm.push(kk);
}
else if(word=="+"||word=="-"||word=="*"||word=="/")
{
double a=mm.top();
mm.pop();
double b=mm.top();
mm.pop();
double result;
if(word=="+") result=b+a;
else if(word=="-") result=b-a;
else if(word=="*") result=b*a;
else result=1.0*b/a;
mm.push(result);
}
}
double final_result=mm.top();
printf("%.10lf\n",final_result);
}
//while(1);
return 0;
}
| a.cc: In function 'int main()':
a.cc:47:24: error: no match for 'operator!=' (operand types are 'std::basic_istream<char>' and 'int')
47 | while(getline(cin,s)!=EOF)
| ~~~~~~~~~~~~~~^~
| |
| std::basic_istream<char>
a.cc:47:24: note: candidate: 'operator!=(int, int)' (built-in)
47 | while(getline(cin,s)!=EOF)
| ^
a.cc:47:24: note: no known conversion for argument 1 from 'std::basic_istream<char>' to 'int'
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)'
197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/cstdio:42,
from /usr/include/c++/14/ext/string_conversions.h:45,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const std::fpos<_StateT>'
47 | while(getline(cin,s)!=EOF)
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)'
243 | operator!=(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const std::allocator<_CharT>'
47 | while(getline(cin,s)!=EOF)
| ^~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
455 | operator!=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
47 | while(getline(cin,s)!=EOF)
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
500 | operator!=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
47 | while(getline(cin,s)!=EOF)
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1686 | operator!=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
47 | while(getline(cin,s)!=EOF)
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1753 | operator!=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
47 | while(getline(cin,s)!=EOF)
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const std::pair<_T1, _T2>'
47 | while(getline(cin,s)!=EOF)
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47:
/usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
651 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
47 | while(getline(cin,s)!=EOF)
| ^~~
/usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
658 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
47 | while(getline(cin,s)!=EOF)
| ^~~
/usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
47 | while(getline(cin,s)!=EOF)
| ^~~
/usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
47 | while(getline(cin,s)!=EOF)
| ^~~
/usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3847 | operator!=(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>'
47 | while(getline(cin,s)!=EOF)
| ^~~
/usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
47 | while(getline(cin,s)!=EOF)
| ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2613 | operator!=(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const std::tuple<_UTypes ...>'
47 | while(getline(cin,s)!=EOF)
| ^~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
242 | operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: template argument deduction/substitution failed:
a.cc:47:26: note: 'std::basic_istream<char>' is not derived from 'const s |
s174648417 | p00087 | C++ | #include <cstdlib>
#include <iostream>
#include <string>
#include <typeinfo>
#include <stdio.h>
#include <string.h>#include <stack>
#include <sstream>
using namespace std;
void q87() {
string inputs;
for (; getline(cin,inputs);) {
istringstream ss(inputs);
stack<double> stk;
string input;
for (; getline(ss, input, ' ');) {
if (input == "0" || atoi(input.c_str()) != 0) {
stk.push((double)atoi(input.c_str()));
}
else {
if (input == "+") {
double b = stk.top(); stk.pop();
double a = stk.top(); stk.pop();
stk.push(a + b);
}
else if (input == "-") {
double b = stk.top(); stk.pop();
double a = stk.top(); stk.pop();
stk.push(a - b);
}
else if (input == "*") {
double b = stk.top(); stk.pop();
double a = stk.top(); stk.pop();
stk.push(a * b);
}
else if (input == "/") {
double b = stk.top(); stk.pop();
double a = stk.top(); stk.pop();
stk.push(a / b);
}
}
}
cout << stk.top() << endl;
}
}
int main() {
q87();
return 0;
} | a.cc:6:20: warning: extra tokens at end of #include directive
6 | #include <string.h>#include <stack>
| ^
a.cc: In function 'void q87()':
a.cc:14:17: error: 'stack' was not declared in this scope
14 | stack<double> stk;
| ^~~~~
a.cc:8:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
7 | #include <sstream>
+++ |+#include <stack>
8 | using namespace std;
a.cc:14:23: error: expected primary-expression before 'double'
14 | stack<double> stk;
| ^~~~~~
a.cc:18:33: error: 'stk' was not declared in this scope; did you mean 'std'?
18 | stk.push((double)atoi(input.c_str()));
| ^~~
| std
a.cc:23:52: error: 'stk' was not declared in this scope; did you mean 'std'?
23 | double b = stk.top(); stk.pop();
| ^~~
| std
a.cc:28:52: error: 'stk' was not declared in this scope; did you mean 'std'?
28 | double b = stk.top(); stk.pop();
| ^~~
| std
a.cc:33:52: error: 'stk' was not declared in this scope; did you mean 'std'?
33 | double b = stk.top(); stk.pop();
| ^~~
| std
a.cc:38:52: error: 'stk' was not declared in this scope; did you mean 'std'?
38 | double b = stk.top(); stk.pop();
| ^~~
| std
a.cc:44:25: error: 'stk' was not declared in this scope; did you mean 'std'?
44 | cout << stk.top() << endl;
| ^~~
| std
|
s976633896 | p00087 | C++ | #include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
string s;
while(getline(cin,s)){
s+=' ';
stack<double>st;
double p=0;
int t=0;
r(i,s.size()){
if(s[i]==' '&&isdigit(s[i-1])){
if(p!=0){
if(!t)st.push(p),p=0;
else st.push((-1)*p),p=0,t=0;
}
}
else if(s[i]=='*'){
double x1=st.top();st.pop();
double x2=st.top();st.pop();
st.push(x2*x1);
}
else if(s[i]=='+'){
double x1=st.top();st.pop();
double x2=st.top();st.pop();
st.push(x2+x1);
}
else if(s[i]=='/'){
double x1=st.top();st.pop();
double x2=st.top();st.pop();
st.push(x2/x1);
}
else if(s[i]=='-'){
if(isdigit(s[i+1]))t=++;
else{
double x1=st.top();st.pop();
double x2=st.top();st.pop();
st.push(x2-x1);
}
}
else if(isdigit(s[i])){
p*=10,p+=s[i]-'0';
}
}
printf("%.6f\n",st.top());
}
}
} | a.cc: In function 'int main()':
a.cc:34:32: error: expected primary-expression before ';' token
34 | if(isdigit(s[i+1]))t=++;
| ^
a.cc: At global scope:
a.cc:48:1: error: expected declaration before '}' token
48 | }
| ^
|
s253750502 | p00087 | C++ | #include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
string s;
while(getline(cin,s)){
s+=' ';
stack<double>st;
double p=0;
int t=0;
r(i,s.size()){
if(s[i]==' '&&isdigit(s[i-1])){
if(p!=0){
if(!t)st.push(p),p=0;
else st.push((-1)*p),p=0,t=0;
}
}
else if(s[i]=='*'){
double x1=st.top();st.pop();
double x2=st.top();st.pop();
st.push(x2*x1);
}
else if(s[i]=='+'){
double x1=st.top();st.pop();
double x2=st.top();st.pop();
st.push(x2+x1);
}
else if(s[i]=='/'){
double x1=st.top();st.pop();
double x2=st.top();st.pop();
st.push(x2/x1);
}
else if(s[i]=='-'){
if(isdigit(s[i+1]))t++;
else{
double x1=st.top();st.pop();
double x2=st.top();st.pop();
st.push(x2-x1);
}
}
else if(isdigit(s[i])){
p*=10,p+=s[i]-'0';
}
}
printf("%.6f\n",st.top());
}
}
} | a.cc:48:1: error: expected declaration before '}' token
48 | }
| ^
|
s197929997 | p00087 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>
using namespace std;
typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair
template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }
char s[1000];
int main() {
string str;
stack<double> num;
while(gets(s)){
str=s;
//cout<<str;
int i;
for(i=0;i<str.size();){
if('0'<=str[i]&&str[i]<='9'){
double d=0;
while('0'<=str[i]&&str[i]<='9'){
d=d*10+str[i]-'0';
i++;
}
num.push(d);
//cout<<d<<endl;
}else if(str[i]!=' '&&str[i]!='\n'){
//cout<<str[i]<<endl;
double a,b;
a=num.top();
num.pop();
b=num.top();
num.pop();
if(str[i]=='+')num.push(a+b);
if(str[i]=='-')num.push(b-a);
if(str[i]=='*')num.push(a*b);
if(str[i]=='/')num.push(b/a);
i++;
//cout<<num.top()<<endl;
}else i++;
}
cout<<num.top()<<endl;
num.pop();
}
return 0;
} | a.cc: In function 'int main()':
a.cc:36:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
36 | while(gets(s)){
| ^~~~
| getw
|
s965251560 | p00087 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
using namespace std;
typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair
template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }
char s[100];
double st[100];
int main() {
while(gets(s)){
int i;
int pos=0;
double a=0;
bool num=false;
for(i=0;i<strlen(s);i++){
//cout<<pos<<endl;
//cout<<" "<<st[0]<<endl;
//cout<<" "<<st[1]<<endl;
//cout<<" "<<st[2]<<endl;
if('0'<=s[i]&&s[i]<='9'){
a=a*10+s[i]-'0';
num=true;
}else if(s[i]==' '){
if(num)st[pos++]=a;
a=0;
num=false;
}else if(s[i]=='+'){
st[pos-2]=st[pos-2]+st[pos-1];
pos--;
}else if(s[i]=='-'){
st[pos-2]=st[pos-2]-st[pos-1];
pos--;
}else if(s[i]=='*'){
st[pos-2]=st[pos-2]*st[pos-1];
pos--;
}else{
st[pos-2]=st[pos-2]/st[pos-1];
pos--;
}
}
cout<<st[0]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:35:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
35 | while(gets(s)){
| ^~~~
| getw
|
s985805584 | p00087 | C++ | #include <cstdio>
#include <stdlib.h>
#include <stack>
#include <iostream>
using namespace std;
int main(int argc, char const* argv[])
{
char str[81];
stack<double> data;
double a,b;
while( 1 ){
gets( str );
char *t;
while( data.empty() == false ) data.pop();
t = strtok( str, " " );
if( t[0] < '0' || t[0] > '9' ){
a = data.top();
data.pop();
b = data.top();
data.pop();
if( t[0] == '+' ){
data.push( b + a );
}
if( t[0] == '-' ){
data.push( b - a );
}
if( t[0] == '/' ){
data.push( b / a );
}
if( t[0] == '*' ){
data.push( b * a );
}
} else {
data.push( atof( t ) );
}
while( ( t = strtok( NULL, " " ) ) != NULL ){
if( t[0] < '0' || t[0] > '9' ){
a = data.top();
data.pop();
b = data.top();
data.pop();
if( t[0] == '+' ){
data.push( b + a );
}
if( t[0] == '-' ){
data.push( b - a );
}
if( t[0] == '/' ){
data.push( b / a );
}
if( t[0] == '*' ){
data.push( b * a );
}
} else {
data.push( atof( t ) );
}
}
printf("%.6f\n",data.top());
data.pop();
}
return 0;
} | a.cc: In function 'int main(int, const char**)':
a.cc:15:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
15 | gets( str );
| ^~~~
| getw
a.cc:20:21: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
20 | t = strtok( str, " " );
| ^~~~~~
| strtoq
|
s987955846 | p00087 | C++ | #include <cstdio>
#include <stdlib.h>
#include <stack>
#include <iostream>
#include <string.h>
using namespace std;
int main(int argc, char const* argv[])
{
char str[81];
stack<double> data;
double a,b;
while( 1 ){
gets( str );
char *t;
while( data.empty() == false ) data.pop();
t = strtok( str, " " );
if( t[0] < '0' || t[0] > '9' ){
a = data.top();
data.pop();
b = data.top();
data.pop();
if( t[0] == '+' ){
data.push( b + a );
}
if( t[0] == '-' ){
data.push( b - a );
}
if( t[0] == '/' ){
data.push( b / a );
}
if( t[0] == '*' ){
data.push( b * a );
}
} else {
data.push( atof( t ) );
}
while( ( t = strtok( NULL, " " ) ) != NULL ){
if( t[0] < '0' || t[0] > '9' ){
a = data.top();
data.pop();
b = data.top();
data.pop();
if( t[0] == '+' ){
data.push( b + a );
}
if( t[0] == '-' ){
data.push( b - a );
}
if( t[0] == '/' ){
data.push( b / a );
}
if( t[0] == '*' ){
data.push( b * a );
}
} else {
data.push( atof( t ) );
}
}
printf("%.6f\n",data.top());
data.pop();
}
return 0;
} | a.cc: In function 'int main(int, const char**)':
a.cc:16:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
16 | gets( str );
| ^~~~
| getw
|
s559027785 | p00087 | C++ | #include<iostream>
#include<cstdio>
#include<cmath>
#include<stack>
using namespace std;
bool digit(char c){
return (c>='0') && (c<='9');
}
double stoi(string s){
double k = 1.0,res = 0.0;
for(int i = (int)s.size()-1;i>=0;i--){
res += (s[i]-'0') * k;
k *= 10;
}
return res;
}
double cal(double x, double y, char z){
if(z == '+')return x+y;
if(z == '-')return x-y;
if(z == '*')return x*y;
if(z == '/')return x/y;
else return x+y;
}
int main(){
stack<double> a;
char str[100];
while(fgets(str,100,stdin)!=NULL){
int pos = 0;
while(1){
if(str[pos] == '\n')break;
if(digit(str[pos])){
string tmp;
tmp.push_back(str[pos]);
while(1){
pos++;
if(str[pos] == ' ' || str[pos] == '\n')break;
tmp.push_back(str[pos]);
}
a.push(stoi(tmp));
cout << "[" << a.top() << "]" << endl;
}else if(str[pos] == ' '){
pos++;
}else if(str[pos] == '-' && digit(str[pos+1])){
string tmp;
pos++;
tmp.push_back(str[pos]);
while(1){
pos++;
if(str[pos] == ' ' || str[pos] == '\n')break;
tmp.push_back(str[pos]);
}
a.push(-1*stoi(tmp));
cout << "[" << a.top() << "]" << endl;
}else{
double x,y;
y = a.top();
a.pop();
x = a.top();
a.pop();
a.push(cal(x,y,str[pos]));
pos++;
}
}
//if(a.empty())cout << 0 << endl;
else cout << a.top() << endl;
}
} | a.cc: In function 'int main()':
a.cc:44:20: error: call of overloaded 'stoi(std::string&)' is ambiguous
44 | a.push(stoi(tmp));
| ~~~~^~~~~
a.cc:11:8: note: candidate: 'double stoi(std::string)'
11 | double stoi(string s){
| ^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
a.cc:57:23: error: call of overloaded 'stoi(std::string&)' is ambiguous
57 | a.push(-1*stoi(tmp));
| ~~~~^~~~~
a.cc:11:8: note: candidate: 'double stoi(std::string)'
11 | double stoi(string s){
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
a.cc:71:5: error: 'else' without a previous 'if'
71 | else cout << a.top() << endl;
| ^~~~
|
s357566072 | p00087 | C++ | #include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
stack<double> s;
double a, b;
char c[80];
while (cin >> c)
{
if (c == EOF) return 0;
if (c[0] == '+')
{
b = s.top(), s.pop();
a = s.top(), s.pop();
s.push(a + b);
}
else if (c[0] == '-')
{
b = s.top(), s.pop();
a = s.top(), s.pop();
s.push(a - b);
}
else if (c[0] == '*')
{
b = s.top(), s.pop();
a = s.top(), s.pop();
s.push(a * b);
}
else if (c[0] == '/')
{
b = s.top(), s.pop();
a = s.top(), s.pop();
s.push(a / b);
}
else
s.push(atof(c));
if (cin.get() == '\n')
printf("%.6lf\n", s.top());
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
13 | if (c == EOF) return 0;
| ^
|
s061438277 | p00087 | C++ | #include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
int main()
{
stack<double> s;
double a, b;
char c[80], bf;
while (std::cin >> c)
{
if (c[0] == '+')
{
b = s.top(), s.pop();
a = s.top(), s.pop();
s.push(a+b);
}
else if (c[0] == '-' && c[1] == 0)
{
b = s.top(), s.pop();
a = s.top(), s.pop();
s.push(a-b);
}
else if (c[0] == '*')
{
b = s.top(), s.pop();
a = s.top(), s.pop();
s.push(a*b);
}
else if (c[0] == '/')
{
b = s.top(), s.pop();
a = s.top(), s.pop();
s.push(a/b);
}
else
{
s.push(atof(c));
}
if ((bf = getchar()) == '\n')
printf("%.6f\n", s.top());
if (bf == -1)
return 0;
}
} | a.cc: In function 'int main()':
a.cc:7:9: error: 'stack' was not declared in this scope; did you mean 'std::stack'?
7 | stack<double> s;
| ^~~~~
| std::stack
In file included from /usr/include/c++/14/stack:63,
from a.cc:2:
/usr/include/c++/14/bits/stl_stack.h:99:11: note: 'std::stack' declared here
99 | class stack
| ^~~~~
a.cc:7:15: error: expected primary-expression before 'double'
7 | stack<double> s;
| ^~~~~~
a.cc:14:29: error: 's' was not declared in this scope
14 | b = s.top(), s.pop();
| ^
a.cc:20:29: error: 's' was not declared in this scope
20 | b = s.top(), s.pop();
| ^
a.cc:26:29: error: 's' was not declared in this scope
26 | b = s.top(), s.pop();
| ^
a.cc:32:29: error: 's' was not declared in this scope
32 | b = s.top(), s.pop();
| ^
a.cc:38:25: error: 's' was not declared in this scope
38 | s.push(atof(c));
| ^
a.cc:41:42: error: 's' was not declared in this scope
41 | printf("%.6f\n", s.top());
| ^
|
s789724230 | p00087 | C++ | #include <iostream>
#include <stack>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
char in[100] = {};
while(cin.getline(in,99)&&in[0]){
stack<double> s;
for(int i = 0; i < 100; i++){
while(c[i] == '.');
}
char* c = in;
do{
if('0' <= *c && *c <= '9'){
int a = 0;
while('0'<=*c && *c <= '9'){
a *= 10;
a += *c-'0';
++c;
}
s.push((double)a);
}else{
double b = s.top();
s.pop();
double a = s.top();
s.pop();
switch(*c){
case '+':
s.push(a+b);
break;
case '-':
s.push(a-b);
break;
case '*':
s.push(a*b);
break;
case '/':
while(b == 0);
s.push(a/b);
break;
}
++c;
}
++c;
}while(*c);
printf("%.6f\n",s.top());
memset(in,0,sizeof in);
}
} | a.cc: In function 'int main()':
a.cc:12:31: error: 'c' was not declared in this scope
12 | while(c[i] == '.');
| ^
|
s958557812 | p00087 | C++ | #include <stdio.h>
#include <string.h>
double RB[1005];double ans;int last;char T[99];
void divid() {int i,j=strlen(T);double k=0;T[j]='=';last=0;for (i=0;i<=j;i++) {if (T[i]>='0' && T[i]<='9') k=k*10+(T[i]-'0'); else {if (k) {RB[last++]=k,k=0;continue;} if (T[i]=='-') last--,RB[last-1]-=RB[last]; else if (T[i]=='+') last--,RB[last-1]+=RB[last]; else if (T[i]=='*') last--,RB[last-1]*=RB[last]; else if (T[i]=='/') last--,RB[last-1]/=RB[last];}} ans=RB[0];}
int main() {while (gets(T)!=NULL) {last=0;ans=0.000000;divid();printf("%.6lf\n",ans);} return 0;} | a.cc: In function 'int main()':
a.cc:5:20: error: 'gets' was not declared in this scope; did you mean 'getw'?
5 | int main() {while (gets(T)!=NULL) {last=0;ans=0.000000;divid();printf("%.6lf\n",ans);} return 0;}
| ^~~~
| getw
|
s147870152 | p00087 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm> // require sort next_permutation count __gcd reverse etc.
#include <cstdlib> // require abs exit atof atoi
#include <cstdio> // require scanf printf
#include <functional>
#include <numeric> // require accumulate
#include <cmath> // require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip> // require setw
#include <sstream> // require stringstream
#include <cstring> // require memset
#include <cctype> // require tolower, toupper
#include <fstream> // require freopen
#include <ctime> // require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
double stod (string s )
{
stringstream ss (s );
double res;
ss >> res;
return res;
}
double Reverse_Polish_Natation (string t )
{
stringstream ss (t );
string s = "";
stack<double> st;
while (ss >> s ){
if (isdigit (s[0] ) || (s[0] == '-' && s.length() > 1 && isdigit (s[1] ) ) ){
st.push (stod (s ) );
}else{
double b = st.top(); st.pop();
double a = st.top(); st.pop();
double c = 0.0;
char ope = s[0];
switch (ope ){
case '+': c = a + b; break;
case '-': c = a - b; break;
case '*': c = a * b; break;
case '/': c = a / b; break;
} // end switch
st.push (c );
} // end if
} // end while
double res = st.top();
return res;
}
int main()
{a
// cut here before submit
// freopen ("testcase.SME", "r", stdin );
string str = "";
while (getline (cin, str ) ){
double res = Reverse_Polish_Natation (str );
printf ("%.9lf\n", res );
} // end loop
return 0;
} | a.cc: In function 'double Reverse_Polish_Natation(std::string)':
a.cc:48:39: error: call of overloaded 'stod(std::string&)' is ambiguous
48 | st.push (stod (s ) );
| ~~~~~^~~~
a.cc:32:8: note: candidate: 'double stod(std::string)'
32 | double stod (string s )
| ^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4199:3: note: candidate: 'double std::__cxx11::stod(const std::string&, std::size_t*)'
4199 | stod(const string& __str, size_t* __idx = 0)
| ^~~~
a.cc: In function 'int main()':
a.cc:70:2: error: 'a' was not declared in this scope
70 | {a
| ^
a.cc:74:30: error: 'str' was not declared in this scope; did you mean 'std'?
74 | while (getline (cin, str ) ){
| ^~~
| std
|
s103877847 | p00087 | C++ | #include<iostream>
#include<stack>
#include<string>
#include<cstdio>
using namespace std;
int main(){
string s;
double x,y;
while(getline(cin,s)){
double k = 0;
bool p = false;
stack < double > a
for(int i=0;i<s.size();i++){
if(s[i] == '+' || s[i] == '-' || s[i] == '*' || s[i] == '/'){
x = a.top();
a.pop();
y = a.top();
a.pop();
if(s[i] == '+') a.push(y+x);
else if(s[i] == '-') a.push(y-x);
else if(s[i] == '*') a.push(y*x);
else if(s[i] == '/') a.push(y/x);
}
if(s[i] <= '9' && s[i] >= '0'){
k *= 10;
k += (s[i] - '0');
p = true;
}
if(p == true && (s[i] == ' ' || s[i] == '\0')){
a.push(k);
k = 0;
p = false;
}
}
printf("%.6f\n",a.top());
a.pop();
}
} | a.cc: In function 'int main()':
a.cc:17:7: error: expected initializer before 'for'
17 | for(int i=0;i<s.size();i++){
| ^~~
a.cc:17:19: error: 'i' was not declared in this scope
17 | for(int i=0;i<s.size();i++){
| ^
a.cc:46:21: error: 'a' was not declared in this scope
46 | printf("%.6f\n",a.top());
| ^
|
s210281033 | p00087 | C++ | include <iostream>
#include <stack>
#include <string>
#include <sstream>
#include <cstdio>
int main()
{
std::string s;
while(std::getline(std::cin,s)){
std::stack<double> stack;
std::stringstream ss(s);
while(ss >> s){
if('0' <= s[0] && s[0] <= '9'){
stack.push(std::stoi(s));
} else {
auto x1 = stack.top(); stack.pop();
auto x2 = stack.top(); stack.pop();
switch(s[0]){
case '+':
stack.push(x2 + x1);
break;
case '-':
stack.push(x2 - x1);
break;
case '*':
stack.push(x2 * x1);
break;
case '/':
stack.push(x2 / x1);
break;
}
}
}
//std::cout << stack.top() << std::endl;
std::printf("%.6f\n",stack.top());
}
} | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/deque:62,
from /usr/include/c++/14/stack:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __s |
s750069743 | p00087 | C++ | include <iostream>
#include <stack>
#include <string>
#include <sstream>
#include <cstdio>
int main()
{
std::string temp,s;
while(std::getline(std::cin,temp)){
std::stack<double> stack;
std::stringstream ss(temp);
while(ss >> s){
if('0' <= s[0] && s[0] <= '9'){
stack.push(std::stoi(s));
} else {
auto x1 = stack.top(); stack.pop();
auto x2 = stack.top(); stack.pop();
switch(s[0]){
case '+':
stack.push(x2 + x1);
break;
case '-':
stack.push(x2 - x1);
break;
case '*':
stack.push(x2 * x1);
break;
case '/':
stack.push(x2 / x1);
break;
}
}
}
//std::cout << stack.top() << std::endl;
std::printf("%.6f\n",stack.top());
}
} | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/deque:62,
from /usr/include/c++/14/stack:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __s |
s768116542 | p00087 | C++ | #include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main(){
long i,j,k;
string s;
double a[80];
for(;;){
getline(cin,s);
if(s=="")break;
i=j=0;
for(;;){
while(s[j]==' ')j++;
if(s[j]==0)break;
else if(s[j]=='+'){i--;a[i]+=a[i+1];j++;}
else if(s[j]=='-'&&(s[j+1]==' '||s[j+1]==0){i--;a[i]-=a[i+1];j++;}
else if(s[j]=='*'){i--;a[i]*=a[i+1];j++;}
else if(s[j]=='/'){i--;a[i]/=a[i+1];j++;}
else{
k=s.find(' ',j);if(k==string::npos)k=s.size();
i++;a[i]=atof(s.substr(j,k-j).c_str());
j=k;
}
}
printf("%.6f\n",a[1]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:44: error: expected ')' before '{' token
17 | else if(s[j]=='-'&&(s[j+1]==' '||s[j+1]==0){i--;a[i]-=a[i+1];j++;}
| ~ ^
| )
a.cc:25:1: error: expected primary-expression before '}' token
25 | }
| ^
|
s440966444 | p00087 | C++ | #include<stdio.h>
#include<stdlib.h>
double ds[100];
int dsp=sizeof(ds)/sizeof(ds[0]);
void dpush(double v) { if(dsp>0) ds[--dsp]=v; } double dpop(void) { return (dsp<sizeof(ds)/sizeof(ds[0])?ds[dsp++]:0.0); }
double RPN( const char * f )
{
double v;
for(;*f;f++) {
switch(*f){
case '+' : v=dpop(); dpush(dpop()+v); break ;
case '-' : v=dpop(); dpush(dpop()-v); break ;
case '*' : v=dpop(); dpush(dpop()*v); break ;
case '/' : v=dpop(); dpush(dpop()/v); break ;
default :
dpush(atof(f)) ;
for(;*f>='0'&&*f<='9';i++);
i--;
break ;
}
i++;
}
return dpop();
}
int main(void){
char s[81];
while(fgets(s,sizeof(s),stdin)){
printf("%f\n",RPN(s));
}
return 0;
} | a.cc: In function 'double RPN(const char*)':
a.cc:20:35: error: 'i' was not declared in this scope
20 | for(;*f>='0'&&*f<='9';i++);
| ^
a.cc:21:13: error: 'i' was not declared in this scope
21 | i--;
| ^
a.cc:24:9: error: 'i' was not declared in this scope
24 | i++;
| ^
|
s488969134 | p00087 | C++ | #include<iostream>
#include<stack>
#include<algorithm>
#include<string>
#include<cstdio>
using namespace std;
int main(){
stack<double> st;
double a, b;
char s[105];
char w;
while(~scanf("%s%c", s, &w)){
switch(s[0]){
case '+':
a = st.top();st.pop();
b = st.top();st.pop();
st.push(b+a);
break;
case '-':
a = st.top();st.pop();
b = st.top();st.pop();
st.push(b-a);
break;
case '*':
a = st.top();st.pop();
b = st.top();st.pop();
st.push(b*a);
break;
case '/':
a = st.top();st.pop();
b = st.top();st.pop();
if(a == 0)return 0;
st.push(b/a);
break;
default:
a=0
sscanf(s, "%lf", &a);
st.push(a);
}
if(w == '\n'){
cout << st.top() << endl;
while(!st.empty())
st.pop();
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:36:4: error: expected ';' before 'sscanf'
36 | a=0
| ^
| ;
37 | sscanf(s, "%lf", &a);
| ~~~~~~
|
s051827022 | p00088 | Java | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
class Main {
public static void main( final String[] args ) {
final char[] inFromLst = { ' ', '\'', ',', '-', '.', '?', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
final String[] inToLst = { "101" ,"000000" ,"000011" ,"10010001" ,"010001" ,"000001" ,"100101" ,"10011010" ,"0101" ,"0001" ,"110" ,"01001" ,"10011011" ,"010000" ,"0111" ,"10011000" ,"0110" ,"00100" ,"10011001" ,"10011110" ,"00101" ,"111" ,"10011111" ,"1000" ,"00110" ,"00111" ,"10011100" ,"10011101" ,"000010" ,"10010010" ,"10010011" ,"10010000" };
final HashMap<Character, String> inMap = new HashMap<Character, String>();
for ( int i = 0; i < inFromLst.length; i++ ) {
inMap.put( inFromLst[ i ], inToLst[ i ] );
}
final String[] outFromLst = { "00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111", "01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111", "10000", "10001", "10010", "10011", "10100", "10101", "10110", "10111", "11000", "11001", "11010", "11011", "11100", "11101", "11110", "11111" };
final char[] outToLst = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', '.', ',', '-', '\'', '?' };
final Map<String, Character> outMap = new HashMap<String, Character>();
for ( int i = 0; i < outFromLst.length; i++ ) {
outMap.put( outFromLst[ i ], outToLst[ i ] );
}
while ( stdin.hasNextLine() ) {
final Scanner stdin = new Scanner( System.in );
final String input = stdin.nextLine();
final StringBuilder in = new StringBuilder();
for ( final char ch : input.toCharArray() ) {
in.append( inMap.get( ch ) );
}
for ( int i = 0; i < in.length() % 5; i++ ) {
in.append( '0' );
}
final StringBuilder out = new StringBuilder();
final int no = in.length() / 5;
for ( int i = 0; i < no; i++ ) {
final String token = in.substring( i * 5, ( i + 1 ) * 5 );
out.append( outMap.get( token ) );
}
System.out.println( out.toString() );
}
}
} | Main.java:27: error: cannot find symbol
while ( stdin.hasNextLine() ) {
^
symbol: variable stdin
location: class Main
1 error
|
s719998106 | p00088 | C | #include<stdio.h>
#include<string.h>
#define SIGN_LENGTH 9
#define CIPHER_NUM 32
#define CODE_MAX 801
#define NUL 0x00
#define INITIALIZE 0
#define TEXT_MAX 100
#define FIVE 5
typedef struct cipher
{
char charcter_change_sign[SIGN_LENGTH];
char sign_change_charcter[SIGN_LENGTH];
char charcter;
}CIPHER;
int main(void)
{
short i = INITIALIZE;
short j = INITIALIZE;
short text_length = INITIALIZE;
char input_text[TEXT_MAX];
CIPHER code[CIPHER_NUM] = {
{"100101","00000",'A'},
{"10011010","00001",'B'},
{"0101","00010",'C'},
{"0001","00011",'D'},
{"110","00100",'E'},
{"01001","00101",'F'},
{"10011011","00110",'G'},
{"010000","00111",'H'},
{"0111","01000",'I'},
{"10011000","01001",'J'},
{"0110","01010",'K'},
{"00100","01011",'L'},
{"10011001","01100",'M'},
{"10011110","01101",'N'},
{"00101","01110",'O'},
{"111","01111",'P'},
{"10011111","10000",'Q'},
{"1000","10001",'R'},
{"00110","10010",'S'},
{"00111","10011",'T'},
{"10011100","10100",'U'},
{"10011101","10101",'V'},
{"000010","10110",'W'},
{"10010010","10111",'X'},
{"10010011","11000",'Y'},
{"10010000","11001",'Z'},
{"101","11010",' '},
{"010001","11011",'.'},
{"000011","11100",','},
{"10010001","11101",'-'},
{"000000","11110",'\''},
{"000001","11111",'?'}
};
while(gets(input_text) != NULL)
{
for(i = 0; i < TEXT_MAX; i++)
{
input_text[i] = NUL;
}
for(i = 0; i < CODE_MAX-1; i++)//配列の最後(800番目)には\0が入るためマイナス1してある
{
barcode[i] = NUL;
}
for(i = 0; i < 160;i++)
{
for(j = 0; j < 5; j++)
{
code_fivecut[i][j] = '0';
}
}
for(i = 0; i < TEXT_MAX; i++)
{
text_length++;
if(input_text[i] == NUL)
{
break;
}
}
for(i = 0; i < text_length; i++)
{
for(j = 0; j < CIPHER_NUM; j++)
{
if(input_text[i] == code[j].charcter)
{
strcat(barcode, code[j].charcter_change_sign);
}
}
}
int barcode_length = 0;
for(i = 0; i < 801; i++)
{
barcode_length++;
if( barcode[barcode_length] == '\0')
{
break;
}
}
int c = 0;
for(i = 0; i < barcode_length; i++)
{
for(j = 0; j < 5; j++)
{
if(c < barcode_length)
{
code_fivecut[i][j] = barcode[c];
c++;
}
}
}
int count=0;
for(i = 0;i < CODE_MAX ; i+= 5)
{
if(barcode_length <= i)
{
count = i / 5;
break;
}
}
int k = 0;
int cc = 0;
for(i = 0; i < count; i++)
{
for(j = 0; j < CIPHER_NUM; j++)
{
for(k = 0; k < 5; k++)
{
if(code_fivecut[i][k] == code[j].sign_change_charcter[k])
{
cc++;
}
}
if(cc == 5)
{
printf("%c",code[j].charcter);
}
cc = 0;
}
}
printf("\n");
count = 0;
barcode_length = 0;
text_length = 0;
}
return 0;
} | main.c: In function 'main':
main.c:61:15: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
61 | while(gets(input_text) != NULL)
| ^~~~
| fgets
main.c:61:32: warning: comparison between pointer and integer
61 | while(gets(input_text) != NULL)
| ^~
main.c:70:25: error: 'barcode' undeclared (first use in this function); did you mean 'code'?
70 | barcode[i] = NUL;
| ^~~~~~~
| code
main.c:70:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:77:33: error: 'code_fivecut' undeclared (first use in this function)
77 | code_fivecut[i][j] = '0';
| ^~~~~~~~~~~~
|
s655542251 | p00088 | C | #include<stdio.h>
#include<string.h>
#define SIGN_LENGTH 9
#define CIPHER_NUM 32
#define CODE_MAX 801
#define NUL 0x00
#define INITIALIZE 0
#define TEXT_MAX 100
#define FIVE 5
typedef struct cipher
{
char charcter_change_sign[SIGN_LENGTH];
char sign_change_charcter[SIGN_LENGTH];
char charcter;
}CIPHER;
int main(void)
{
short i = INITIALIZE;
short j = INITIALIZE;
short text_length = INITIALIZE;
char input_text[TEXT_MAX];
CIPHER code[CIPHER_NUM] = {
{"100101","00000",'A'},
{"10011010","00001",'B'},
{"0101","00010",'C'},
{"0001","00011",'D'},
{"110","00100",'E'},
{"01001","00101",'F'},
{"10011011","00110",'G'},
{"010000","00111",'H'},
{"0111","01000",'I'},
{"10011000","01001",'J'},
{"0110","01010",'K'},
{"00100","01011",'L'},
{"10011001","01100",'M'},
{"10011110","01101",'N'},
{"00101","01110",'O'},
{"111","01111",'P'},
{"10011111","10000",'Q'},
{"1000","10001",'R'},
{"00110","10010",'S'},
{"00111","10011",'T'},
{"10011100","10100",'U'},
{"10011101","10101",'V'},
{"000010","10110",'W'},
{"10010010","10111",'X'},
{"10010011","11000",'Y'},
{"10010000","11001",'Z'},
{"101","11010",' '},
{"010001","11011",'.'},
{"000011","11100",','},
{"10010001","11101",'-'},
{"000000","11110",'\''},
{"000001","11111",'?'}
};
while(gets(input_text) != NULL)
{
for(i = 0; i < TEXT_MAX; i++)
{
input_text[i] = NUL;
}
for(i = 0; i < CODE_MAX-1; i++)//配列の最後(800番目)には\0が入るためマイナス1してある
{
barcode[i] = NUL;
}
for(i = 0; i < 160;i++)
{
for(j = 0; j < 5; j++)
{
code_fivecut[i][j] = '0';
}
}
for(i = 0; i < TEXT_MAX; i++)
{
text_length++;
if(input_text[i] == NUL)
{
break;
}
}
for(i = 0; i < text_length; i++)
{
for(j = 0; j < CIPHER_NUM; j++)
{
if(input_text[i] == code[j].charcter)
{
strcat(barcode, code[j].charcter_change_sign);
}
}
}
int barcode_length = 0;
for(i = 0; i < 801; i++)
{
barcode_length++;
if( barcode[barcode_length] == '\0')
{
break;
}
}
int c = 0;
for(i = 0; i < barcode_length; i++)
{
for(j = 0; j < 5; j++)
{
if(c < barcode_length)
{
code_fivecut[i][j] = barcode[c];
c++;
}
}
}
int count=0;
for(i = 0;i < CODE_MAX ; i+= 5)
{
if(barcode_length <= i)
{
count = i / 5;
break;
}
}
int k = 0;
int cc = 0;
for(i = 0; i < count; i++)
{
for(j = 0; j < CIPHER_NUM; j++)
{
for(k = 0; k < 5; k++)
{
if(code_fivecut[i][k] == code[j].sign_change_charcter[k])
{
cc++;
}
}
if(cc == 5)
{
printf("%c",code[j].charcter);
}
cc = 0;
}
}
printf("\n");
count = 0;
barcode_length = 0;
text_length = 0;
}
return 0;
} | main.c: In function 'main':
main.c:61:15: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
61 | while(gets(input_text) != NULL)
| ^~~~
| fgets
main.c:61:32: warning: comparison between pointer and integer
61 | while(gets(input_text) != NULL)
| ^~
main.c:70:25: error: 'barcode' undeclared (first use in this function); did you mean 'code'?
70 | barcode[i] = NUL;
| ^~~~~~~
| code
main.c:70:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:77:33: error: 'code_fivecut' undeclared (first use in this function)
77 | code_fivecut[i][j] = '0';
| ^~~~~~~~~~~~
|
s931379867 | p00088 | C | #include<stdio.h>
#include<string.h>
#define SIGN_LENGTH 9
#define CIPHER_NUM 32
#define CODE_MAX 801
#define NUL 0x00
#define INITIALIZE 0
#define TEXT_MAX 101
#define FIVE 5
typedef struct cipher
{
char charcter_change_sign[SIGN_LENGTH];
char sign_change_charcter[SIGN_LENGTH];
char charcter;
}CIPHER;
int main(void)
{
unsigned short i = INITIALIZE;
unsigned short j = INITIALIZE;
unsigned short k = INITIALIZE;
unsigned short text_length = INITIALIZE;
unsigned short barcode_length = INITIALIZE;
unsigned int count = INITIALIZE;
int c = 0;
int cc = 0;
char input_text[TEXT_MAX];
char barcode[CODE_MAX];
char code_fivecut[CODE_MAX / FIVE][FIVE];/*160:5*/
CIPHER code[CIPHER_NUM] = {
{"100101","00000",'A'},
{"10011010","00001",'B'},
{"0101","00010",'C'},
{"0001","00011",'D'},
{"110","00100",'E'},
{"01001","00101",'F'},
{"10011011","00110",'G'},
{"010000","00111",'H'},
{"0111","01000",'I'},
{"10011000","01001",'J'},
{"0110","01010",'K'},
{"00100","01011",'L'},
{"10011001","01100",'M'},
{"10011110","01101",'N'},
{"00101","01110",'O'},
{"111","01111",'P'},
{"10011111","10000",'Q'},
{"1000","10001",'R'},
{"00110","10010",'S'},
{"00111","10011",'T'},
{"10011100","10100",'U'},
{"10011101","10101",'V'},
{"000010","10110",'W'},
{"10010010","10111",'X'},
{"10010011","11000",'Y'},
{"10010000","11001",'Z'},
{"101","11010",' '},
{"010001","11011",'.'},
{"000011","11100",','},
{"10010001","11101",'-'},
{"000000","11110",'\''},
{"000001","11111",'?'}
};
for(i = 0; i < TEXT_MAX; i++)
{
input_text[i] = NUL;
}
while(gets(input_text) != NULL)
{
for(i = 0; i < CODE_MAX - 1; i++)//配列の最後(800番目)には\0が入るためマイナス1してある
{
barcode[i] = NUL;
}
for(i = 0; i < CODE_MAX / FIVE;i++)
{
for(j = 0; j < 5; j++)
{
code_fivecut[i][j] = '0';
}
}
for(i = 0; i < TEXT_MAX; i++)
{
text_length++;
if(input_text[i] == NUL)
{
break;
}
}
for(i = 0; i < text_length; i++)
{
for(j = 0; j < CIPHER_NUM; j++)
{
if(input_text[i] == code[j].charcter)
{
strcat(barcode, code[j].charcter_change_sign);
}
}
}
for(i = 0; i < CODE_MAX 801; i++)
{
barcode_length++;
if( barcode[barcode_length] == '\0')
{
break;
}
}
for(i = 0; i < barcode_length; i++)
{
for(j = 0; j < 5; j++)
{
if(c < barcode_length)
{
code_fivecut[i][j] = barcode[c];
c++;
}
}
}
for(i = 0;i < CODE_MAX ; i+= 5)
{
if(barcode_length <= i)
{
count = i / 5;
break;
}
}
for(i = 0; i < count; i++)
{
for(j = 0; j < CIPHER_NUM; j++)
{
for(k = 0; k < FIVE; k++)
{
if(code_fivecut[i][k] == code[j].sign_change_charcter[k])
{
cc++;
}
}
if(cc == 5)
{
printf("%c",code[j].charcter);
}
cc = 0;
}
}
printf("\n");
count = 0;
barcode_length = 0;
text_length = 0;
}
return 0;
} | main.c: In function 'main':
main.c:73:15: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
73 | while(gets(input_text) != NULL)
| ^~~~
| fgets
main.c:73:32: warning: comparison between pointer and integer
73 | while(gets(input_text) != NULL)
| ^~
main.c:108:41: error: expected ';' before numeric constant
108 | for(i = 0; i < CODE_MAX 801; i++)
| ^~~
|
s177346324 | p00088 | C | #include<stdio.h>
#include<string.h>
#define SIGN_LENGTH 9
#define CIPHER_NUM 32
#define CODE_MAX 801
#define NUL 0x00
#define INITIALIZE 0
#define TEXT_MAX 101
#define FIVE 5
typedef struct cipher
{
char charcter_change_sign[SIGN_LENGTH];
char sign_change_charcter[SIGN_LENGTH];
char charcter;
}CIPHER;
int main(void)
{
CIPHER code[CIPHER_NUM] = {
{"100101","00000",'A'},
{"10011010","00001",'B'},
{"0101","00010",'C'},
{"0001","00011",'D'},
{"110","00100",'E'},
{"01001","00101",'F'},
{"10011011","00110",'G'},
{"010000","00111",'H'},
{"0111","01000",'I'},
{"10011000","01001",'J'},
{"0110","01010",'K'},
{"00100","01011",'L'},
{"10011001","01100",'M'},
{"10011110","01101",'N'},
{"00101","01110",'O'},
{"111","01111",'P'},
{"10011111","10000",'Q'},
{"1000","10001",'R'},
{"00110","10010",'S'},
{"00111","10011",'T'},
{"10011100","10100",'U'},
{"10011101","10101",'V'},
{"000010","10110",'W'},
{"10010010","10111",'X'},
{"10010011","11000",'Y'},
{"10010000","11001",'Z'},
{"101","11010",' '},
{"010001","11011",'.'},
{"000011","11100",','},
{"10010001","11101",'-'},
{"000000","11110",'\''},
{"000001","11111",'?'}
};
char input_text[TEXT_MAX];
for(i = 0; i < TEXT_MAX; i++)
{
input_text[i] = NUL;
}
while(gets(input_text) != NULL)
{
unsigned short i = INITIALIZE;
unsigned short j = INITIALIZE;
unsigned short k = INITIALIZE;
unsigned short text_length = INITIALIZE;
unsigned short barcode_length = INITIALIZE;
unsigned int count = INITIALIZE;
int c = 0;
int cc = 0;
char barcode[CODE_MAX];
char code_fivecut[CODE_MAX / FIVE][FIVE];/*160:5*/
for(i = 0; i < CODE_MAX - 1; i++)//配列の最後(800番目)には\0が入るためマイナス1してある
{
barcode[i] = NUL;
}
for(i = 0; i < CODE_MAX / FIVE;i++)
{
for(j = 0; j < 5; j++)
{
code_fivecut[i][j] = '0';
}
}
for(i = 0; i < TEXT_MAX; i++)
{
text_length++;
if(input_text[i] == NUL)
{
break;
}
}
for(i = 0; i < text_length; i++)
{
for(j = 0; j < CIPHER_NUM; j++)
{
if(input_text[i] == code[j].charcter)
{
strcat(barcode, code[j].charcter_change_sign);
}
}
}
for(i = 0; i < CODE_MAX; i++)
{
barcode_length++;
if( barcode[barcode_length] == '\0')
{
break;
}
}
for(i = 0; i < barcode_length; i++)
{
for(j = 0; j < FIVE; j++)
{
if(c < barcode_length)
{
code_fivecut[i][j] = barcode[c];
c++;
}
}
}
for(i = 0;i < CODE_MAX ; i+= 5)
{
if(barcode_length <= i)
{
count = i / 5;
break;
}
}
for(i = 0; i < count; i++)
{
for(j = 0; j < CIPHER_NUM; j++)
{
for(k = 0; k < FIVE; k++)
{
if(code_fivecut[i][k] == code[j].sign_change_charcter[k])
{
cc++;
}
}
if(cc == 5)
{
printf("%c",code[j].charcter);
}
cc = 0;
}
}
printf("\n");
}
return 0;
} | main.c: In function 'main':
main.c:60:13: error: 'i' undeclared (first use in this function)
60 | for(i = 0; i < TEXT_MAX; i++)
| ^
main.c:60:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:65:15: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
65 | while(gets(input_text) != NULL)
| ^~~~
| fgets
main.c:65:32: warning: comparison between pointer and integer
65 | while(gets(input_text) != NULL)
| ^~
|
s176346427 | p00088 | C | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);} | main.c:1:53: warning: data definition has no type or storage class
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
| ^
main.c:1:53: error: type defaults to 'int' in declaration of 'L' [-Wimplicit-int]
main.c:1:123: warning: data definition has no type or storage class
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
| ^
main.c:1:123: error: type defaults to 'int' in declaration of 'B' [-Wimplicit-int]
main.c:1:289: warning: data definition has no type or storage class
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
| ^
main.c:1:289: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
main.c:1:291: error: type defaults to 'int' in declaration of 'l' [-Wimplicit-int]
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
| ^
main.c:1:293: error: return type defaults to 'int' [-Wimplicit-int]
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
| ^~~~
main.c: In function 'main':
main.c:1:293: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:308: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
| ^~~~~~~
main.c:1:1: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
+++ |+#include <stdio.h>
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
main.c:1:378: error: implicit declaration of function 'putchar' [-Wimplicit-function-declaration]
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
| ^~~~~~~
main.c:1:378: note: include '<stdio.h>' or provide a declaration of 'putchar'
main.c:1:403: error: 'elsel' undeclared (first use in this function)
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
| ^~~~~
main.c:1:403: note: each undeclared identifier is reported only once for each function it appears in
main.c:1:450: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
main.c:1:450: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
1 | char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr();L[]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6};B[]={0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01};b,l;main(c){for(;c=getchar(),c+1;)if(c-10)for(c=strchr(C,c)-C,b=b<<L[c]|B[c],l+=L[c];l>4;putchar(C[b>>l&31]))l-=5;elsel&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);exit(0);}
| |
s400699646 | p00088 | C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
int main()
{
int c[99],m[32]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6},d[32]={37,154,5,1,6,9,155,16,7,152,6,4,153,158,5,7,159,8,6,7,156,157,2,146,147,144,5,0,3,145,17,1},
buffer=0,t,p=0,i,w[32]={65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,32,46,44,45,39,63};
c[32]=26,c[39]=27,c[44]=28,c[45]=29,c[46]=30,c[63]=31;
for(i=0;i<25;i++)
c[65+i]=i;
while(t=getch())
{
if(t==13||t==26)
{
if(p>0)
putchar(w[buffer<<5-p]);
if(t==26)
break;
puts("");
buffer=p=0;
}
else
{
i=c[t];
buffer<<=m[i];
buffer|=d[i];
p+=m[i];
for(;p>=5;p-=5)
{
putchar(w[buffer>>p-5]);
buffer&=~(31<<p-5);
}
}
}
return 0;
} | main.c:4:9: fatal error: conio.h: No such file or directory
4 | #include<conio.h>
| ^~~~~~~~~
compilation terminated.
|
s037928266 | p00088 | C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int c[99],m[32]={6,8,4,4,3,5,8,6,4,8,4,5,8,8,5,3,8,4,5,5,8,8,6,8,8,8,3,6,6,8,6,6},d[32]={37,154,5,1,6,9,155,16,7,152,6,4,153,158,5,7,159,8,6,7,156,157,2,146,147,144,5,0,3,145,17,1},
buffer=0,t,p=0,i,w[32]={65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,32,46,44,45,39,63};
c[32]=26,c[39]=27,c[44]=28,c[45]=29,c[46]=30,c[63]=31;
for(i=0;i<25;i++)
c[65+i]=i;
while(t=fgetchar())
{
if(t==13||t==26)
{
if(p>0)
putchar(w[buffer<<5-p]);
if(t==26)
break;
puts("");
buffer=p=0;
}
else
{
i=c[t];
buffer<<=m[i];
buffer|=d[i];
p+=m[i];
for(;p>=5;p-=5)
{
putchar(w[buffer>>p-5]);
buffer&=~(31<<p-5);
}
}
}
return 0;
} | main.c: In function 'main':
main.c:12:17: error: implicit declaration of function 'fgetchar'; did you mean 'getchar'? [-Wimplicit-function-declaration]
12 | while(t=fgetchar())
| ^~~~~~~~
| getchar
|
s074564610 | p00088 | C | #include <stdio.h>
#include <string.h>
int main(void)
{
int i,j;
char *a = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char *b[] = {
"101","000000","000011","10010001","010001","000001","100101",
"10011010","0101","0001","110","01001","10011011","010000","0111",
"10011000","0110","00100","10011001","10011110","00101","111",
"10011111","1000","00110","00111","10011100","10011101","000010",
"10010010","10010011","10010000"
};
char *c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
char d[4096];
char e[4096];
//while(1) {
puts("\nSample Input");
if(!*gets(d)) break;
e[0] = '\0';
i = 0;
while(d[i] != '\0') strcat(e,b[strchr(a,d[i++]) - a]);
i = 5 - strlen(e) % 5;
while(i--) strcat(e,"0");
puts("Output for the Sample Input");
i = 0;
while(e[i] != '\0') {
j = 0;
j += (e[i++] - '0') << 4;
j += (e[i++] - '0') << 3;
j += (e[i++] - '0') << 2;
j += (e[i++] - '0') << 1;
j += (e[i++] - '0');
putc(c[j],stdout);
}
//}
return 0;
} | main.c: In function 'main':
main.c:19:10: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
19 | if(!*gets(d)) break;
| ^~~~
| fgets
main.c:19:9: error: invalid type argument of unary '*' (have 'int')
19 | if(!*gets(d)) break;
| ^~~~~~~~
main.c:19:19: error: break statement not within loop or switch
19 | if(!*gets(d)) break;
| ^~~~~
|
s009569380 | p00088 | C | #include <stdio.h>
#include <string.h>
main()
{
int i,j,k;
char *a = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char *b[] = {
"101","000000","000011","10010001","010001","000001","100101",
"10011010","0101","0001","110","01001","10011011","010000","0111",
"10011000","0110","00100","10011001","10011110","00101","111",
"10011111","1000","00110","00111","10011100","10011101","000010",
"10010010","10010011","10010000"
};
char *c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
char d[4096];
char e[4096];
d[0] = '\0';
//while(1) {
gets(e);
if(feof(stdin)) break;
strcat(d,e);
strcat(d," ");
//}
d[strlen(d) - 1] = '\0';
e[0] = '\0';
i = 0;
while(d[i] != '\0') strcat(e,b[strchr(a,d[i++]) - a]);
i = 5 - strlen(e) % 5;
while(i--) strcat(e,"0");
i = 0;
while(e[i] != '\0') {
j = 0;
k = 4;
do {
j += (e[i++] - '0') << k;
} while(k--);
putc(c[j],stdout);
}
return 0;
} | main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main()
| ^~~~
main.c: In function 'main':
main.c:19:5: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
19 | gets(e);
| ^~~~
| fgets
main.c:20:21: error: break statement not within loop or switch
20 | if(feof(stdin)) break;
| ^~~~~
|
s596588660 | p00088 | C | #include <stdio.h>
#include <string.h>
main()
{
int i,j,k;
char *a = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char *b[] = {
"101","000000","000011","10010001","010001","000001","100101",
"10011010","0101","0001","110","01001","10011011","010000","0111",
"10011000","0110","00100","10011001","10011110","00101","111",
"10011111","1000","00110","00111","10011100","10011101","000010",
"10010010","10010011","10010000"
};
char *c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
char d[4096];
char e[4096];
d[0] = '\0';
//while(1) {
gets(e);
if(feof(stdin)) break;
strcat(d,e);
strcat(d," ");
//}
d[strlen(d) - 1] = '\0';
e[0] = '\0';
i = 0;
while(d[i] != '\0') strcat(e,b[strchr(a,d[i++]) - a]);
i = 5 - strlen(e) % 5;
while(i--) strcat(e,"0");
i = 0;
while(e[i] != '\0') {
j = 0;
k = 4;
do {
j += (e[i++] - '0') << k;
} while(k--);
putc(c[j],stdout);
}
return 0;
} | main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main()
| ^~~~
main.c: In function 'main':
main.c:19:5: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
19 | gets(e);
| ^~~~
| fgets
main.c:20:21: error: break statement not within loop or switch
20 | if(feof(stdin)) break;
| ^~~~~
|
s961014358 | p00088 | C | #include <stdio.h>
main()
{
int i,j,k;
unsigned char *a = "\n ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
unsigned char *b[] = {
"101","101","000000","000011","10010001","010001","000001","100101",
"10011010","0101","0001","110","01001","10011011","010000","0111",
"10011000","0110","00100","10011001","10011110","00101","111",
"10011111","1000","00110","00111","10011100","10011101","000010",
"10010010","10010011","10010000"
};
unsigned char *c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
unsigned char d[4096];
unsigned char *p;
i = 0;
while((k = getc(stdin)) != EOF){
j = 0;
//while(*(a + j) != k) j++;
//p = b[j];
//while(*p) d[i++] = *p++;
}
j = 5 - i % 5;
while(j--) d[i++] = '0';
d[i] = '\0';
i = 0;
while(d[i]) {
j = 0;
k = 4;
do {
j += (d[i++] - '0') << k;
} while(k--);
putc(*(c + j),stdout);
}
*/
return 0;
} | main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main()
| ^~~~
main.c: In function 'main':
main.c:35:4: error: expected expression before '/' token
35 | */
| ^
|
s859961534 | p00088 | C | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#define int64 long long int
using namespace std;
string encode(string, char);
void decode(string);
int main()
{
int c;
string str;
while((c = getchar()) != EOF){
str = encode(str, c);
}
decode(str);
return 0;
}
void decode(string str)
{
int i, len, r;
string part;
const string code[32] = {
"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111",
"01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111",
"10000", "10001", "10010", "10011", "10100", "10101", "10110", "10111",
"11000", "11001", "11010", "11011", "11100", "11101", "11110", "11111"
};
const char ch[35] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
len = str.size();
for(i=0; i<len / 5; i++){
part = str.substr( 5*i, 5 );
for(int j=0; j<32; j++)
if(part == code[j]) cout << ch[j];
}
if((r = len % 5) != 0){
part = str.substr( 5*i, len-1 );
for(i=0; i<5-r; i++) part += "0";
for(i=0; i<32; i++)
if(part == code[i]) cout << ch[i];
}
cout << endl;
return;
}
string encode(string str, char c)
{
const string code[32] = {
"101", "000000", "000011", "10010001",
"010001", "000001", "100101", "10011010",
"0101", "0001", "110", "01001",
"10011011", "010000", "0111", "10011000",
"0110", "00100", "10011001", "10011110",
"00101", "111", "10011111", "1000",
"00110", "00111", "10011100", "10011101",
"000010", "10010010", "10010011", "10010000"
};
const char ch[35] = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(int i=0; i<32; i++){
if(c == ch[i]){
if(str.empty()) str = code[i];
else str += code[i];
}
}
return str;
} | main.c:3:10: fatal error: iostream: No such file or directory
3 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s069259416 | p00088 | C++ | /*
0088:The Code A Doctor Loved
*/
#include <iostream>
#include <string>
using namespace std;
const string convertList[2][32] =
{
{
"100101", "10011010", "0101", "0001", "110", "01001", "10011011", "010000",
"0111", "10011000", "0110", "00100", "10011001", "10011110", "00101", "111",
"10011111", "1000", "00110", "00111", "10011100", "10011101", "000010", "10010010",
"10010011", "10010000", "101", "000000", "000011", "10010001", "010001", "000001"
},
{
"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111",
"01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111",
"10000", "10001", "10010", "10011", "10100", "10101", "10110", "10111",
"11000", "11001", "11010", "11011", "11100", "11101", "11110", "11111"
}
};
const char charList[32] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
int main(void) {
string str, buff, result;
getline(cin, str);
string::iterator str_it = str.begin();
while(str_it != str.end()) {
for(int i = 0; i < 32; i++) {
if(*str_it == charList[i]) {
buff += convertList[0][i];
break;
}
}
str_it++;
}
while( buff.size() % 5 != 0 ) {
buff += '0';
}
string::iterator buff_it = buff.begin();
while( buff_it != buff.end() ) {
string buffbuff;
for(int i = 0; i < 5; i++, buff_it++) {
buffbuff += *buff_it;
}
for(int i = 0; i < 32; i++) {
if(buffbuff == convertList[1][i]) {
result += charList[i];
break;
}
}
}
cout << result << endl;
} | a.cc:25:27: error: initializer-string for 'const char [32]' is too long [-fpermissive]
25 | const char charList[32] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s801918507 | p00088 | C++ | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
void Calc()
{
var dic = new Dictionary<char, string>
{
{' ', "101"},
{'\'', "000000"},
{',', "000011"},
{'-', "10010001"},
{'.', "010001"},
{'?', "000001"},
{'A', "100101"},
{'B', "10011010"},
{'C', "0101"},
{'D', "0001"},
{'E', "110"},
{'F', "01001"},
{'G', "10011011"},
{'H', "010000"},
{'I', "0111"},
{'J', "10011000"},
{'K', "0110"},
{'L', "00100"},
{'M', "10011001"},
{'N', "10011110"},
{'O', "00101"},
{'P', "111"},
{'Q', "10011111"},
{'R', "1000"},
{'S', "00110"},
{'T', "00111"},
{'U', "10011100"},
{'V', "10011101"},
{'W', "000010"},
{'X', "10010010"},
{'Y', "10010011"},
{'Z', "10010000"},
};
var dic2 = new Dictionary<string, char>
{
{"11010", ' '},
{"11110", '\''},
{"00000", 'A'},
{"00001", 'B'},
{"00010", 'C'},
{"00011", 'D'},
{"00100", 'E'},
{"00101", 'F'},
{"00110", 'G'},
{"00111", 'H'},
{"01000", 'I'},
{"01001", 'J'},
{"01010", 'K'},
{"01011", 'L'},
{"01100", 'M'},
{"01101", 'N'},
{"01110", 'O'},
{"01111", 'P'},
{"10000", 'Q'},
{"10001", 'R'},
{"10010", 'S'},
{"10011", 'T'},
{"10100", 'U'},
{"10101", 'V'},
{"10110", 'W'},
{"10111", 'X'},
{"11000", 'Y'},
{"11001", 'Z'},
{"11011", '.'},
{"11100", ','},
{"11101", '-'},
{"11111", '?'},
};
var str = Console.ReadLine();
var conv = string.Concat(str.Select(x => dic[x]));
var next = conv.Select((x, i) => new { x, i })
.GroupBy(x => x.i / 5)
.Select(x => string.Concat(x.Select(y => y.x)))
.ToArray();
if (next.Any())
next[next.Length - 1] += string.Concat(Enumerable.Repeat('0', 5 - next[next.Length - 1].Length));
Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
}
static void Main()
{
new Program().Calc();
}
} | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Text;
| ^~~~~~
a.cc:97:2: error: expected ';' after class definition
97 | }
| ^
| ;
a.cc: In member function 'void Program::Calc()':
a.cc:10:9: error: 'var' was not declared in this scope
10 | var dic = new Dictionary<char, string>
| ^~~
a.cc:46:13: error: expected ';' before 'dic2'
46 | var dic2 = new Dictionary<string, char>
| ^~~~
a.cc:82:13: error: expected ';' before 'str'
82 | var str = Console.ReadLine();
| ^~~
a.cc:83:13: error: expected ';' before 'conv'
83 | var conv = string.Concat(str.Select(x => dic[x]));
| ^~~~
a.cc:84:13: error: expected ';' before 'next'
84 | var next = conv.Select((x, i) => new { x, i })
| ^~~~
a.cc:84:54: error: expected primary-expression before ')' token
84 | var next = conv.Select((x, i) => new { x, i })
| ^
a.cc:88:13: error: 'next' was not declared in this scope
88 | if (next.Any())
| ^~~~
a.cc:89:38: error: 'string' was not declared in this scope
89 | next[next.Length - 1] += string.Concat(Enumerable.Repeat('0', 5 - next[next.Length - 1].Length));
| ^~~~~~
a.cc:89:52: error: 'Enumerable' was not declared in this scope
89 | next[next.Length - 1] += string.Concat(Enumerable.Repeat('0', 5 - next[next.Length - 1].Length));
| ^~~~~~~~~~
a.cc:90:9: error: 'Console' was not declared in this scope
90 | Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
| ^~~~~~~
a.cc:90:27: error: 'string' was not declared in this scope
90 | Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
| ^~~~~~
a.cc:90:41: error: 'next' was not declared in this scope
90 | Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
| ^~~~
a.cc:90:53: error: 'x' was not declared in this scope
90 | Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
| ^
a.cc:90:56: error: expected primary-expression before '>' token
90 | Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
| ^
a.cc:90:58: error: 'dic2' was not declared in this scope
90 | Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
| ^~~~
a.cc: In static member function 'static void Program::Main()':
a.cc:95:22: error: expected ';' before '.' token
95 | new Program().Calc();
| ^
|
s742397245 | p00088 | C++ | #include<iostream>
#include<string>
#include<map>
using namespace std;
map<string, string> wtoi;
map<string, string> itow;
void make_dictonary1() {
wtoi[" "] = "101"; wtoi["'"] = "000000"; wtoi[","] = "000011"; wtoi["-"] = "10010001"; wtoi["."] = "010001";
wtoi["?"] = "000001"; wtoi["A"] = "100101"; wtoi["B"] = "10011010"; wtoi["C"] = "0101"; wtoi["D"] = "0001";
wtoi["E"] = "110"; wtoi["F"] = "01001"; wtoi["G"] = "10011011"; wtoi["H"] = "010000"; wtoi["I"] = "0111";
wtoi["J"] = "10011000 "; wtoi["K"] = "0110"; wtoi["L"] = "00100"; wtoi["M"] = "10011001"; wtoi["N"] = "00101";
wtoi["O"] = "00101"; wtoi["P"] = "111"; wtoi["Q"] = "10011111"; wtoi["R"] = "1000"; wtoi["S"] = "00110";
wtoi["T"] = "00111"; wtoi["U"] = "10011100"; wtoi["V"] = "10011101"; wtoi["W"] = "000010"; wtoi["X"] = "10010010";
wtoi["Y"] = "10010011"; wtoi["Z"] = "10010000";
}
void make_dictonary2() {
int i, j;
for( i = 0; i < 26; i++ ) {
char c = 'A' + i;
string str;
str += c;
string in;
for( j = 4; j >= 0; j-- ) {
if ( (i>>(j))%2 )
in += '1';
else
in += '0';
}
itow[in] = str;
}
itow["11011"] = "."; itow["11100"] = ","; itow["11101"] = "-"; itow["11110"] = "'"; itow["11111"] = "?";
}
char buf[512];
int buflen;
int main() {
make_dictonary1();
make_dictonary2();
int i, j;
gets(buf);
buflen = strlen(buf);
string intejor;
for( i = 0; i < buflen; i++ ) {
string in;
in += buf[i];
intejor += wtoi[in];
}
string str[514];
for( i = 0; i < intejor.length(); i+=5 ) {
for( int j = i; j < i + 5; j++ ) {
if ( j >= intejor.length() )
str[i] += '0';
else
str[i] += intejor[j];
}
//cout << str[i] << endl;
}
for( j = 0; j < i; j++ ) {
cout << itow[str[j]];
}
cout << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:43:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
43 | gets(buf);
| ^~~~
| getw
a.cc:44:18: error: 'strlen' was not declared in this scope
44 | buflen = strlen(buf);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<map>
+++ |+#include <cstring>
4 | using namespace std;
|
s695633590 | p00088 | C++ | #include <iostream>
#include <cstring>
using namespace std;
int main() {
char code[32][15] = {
"101","000000","000011","10010001","010001","000001","100101","10011010",
"0101","0001","110","01001","10011011","010000","0111","10011000",
"0110","00100","10011001","10011110","00101","111","10011111","1000",
"00110","00111","10011100","10011101","000010","10010010","10010011","10010000"
};
int coden[255];
char tmp[33] = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (int i = 0; i < 32; i++) {
coden[tmp[i]] = i;
}
char str[100];
int makedcode[1500];
int count;
while (gets(str) != NULL) {
count = 0;
for (int i = 0, slen = strlen(str); i < slen; i++) {
for (int j = 0, clen = strlen(code[coden[str[i]]]); j < clen; j++) {
makedcode[count++] = code[coden[str[i]]][j] - '0';
}
}
for (int i = 0, j = 0, sum;; i++, j++) {
if (j == 5) {
if ('a' - 'a' <= sum && sum <= 'z' - 'a')
cout << (char)(sum + 'A');
else {
char c;
switch (sum) {
case 26:
c = ' '; break;
case 27:
c = '.'; break;
case 28:
c = ','; break;
case 29:
c = '-'; break;
case 30:
c = '\''; break;
case 31:
c = '?'; break;
}
cout << c;
}
if (i >= count)
break;
j = 0;
}
if (j == 0)
sum = 0;
if (i < count)
sum = (sum << 1) + makedcode[i];
else
sum = sum << 1;
}
cout << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:16: error: 'gets' was not declared in this scope; did you mean 'getw'?
21 | while (gets(str) != NULL) {
| ^~~~
| getw
|
s992980637 | p00088 | C++ | mp = {}
mp[" "] = "101"
mp["'"] = "000000"
mp[","] = "000011"
mp["-"] = "10010001"
mp["."] = "010001"
mp["?"] = "000001"
mp["A"] = "100101"
mp["B"] = "10011010"
mp["C"] = "0101"
mp["D"] = "0001"
mp["E"]="110"
mp["F"]="01001"
mp["G"]="10011011"
mp["H"]="010000"
mp["I"]="0111"
mp["J"]="10011000"
mp["K"]="0110"
mp["L"]="00100"
mp["M"]="10011001"
mp["N"]="10011110"
mp["O"]="00101"
mp["P"]="111"
mp["Q"]="10011111"
mp["R"]="1000"
mp["S"]="00110"
mp["T"]="00111"
mp["U"]="10011100"
mp["V"]="10011101"
mp["W"]="000010"
mp["X"]="10010010"
mp["Y"]="10010011"
mp["Z"]="10010000"
gyaku = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"
while s=gets
s=s.chomp
t=""
for i in 0...s.length
t+=mp[s[i]]
end
n = t.length
t += "0"*((5-n%5)%5)
n = t.length
res = ""
for i in 0...(n/5)
beg = i*5
id = 0
for j in 0...5
id*=2
id+=(t[beg+j]=="0" ? 0 : 1)
end
res += gyaku[id]
end
puts res
end | a.cc:40:12: error: too many decimal points in number
40 | for i in 0...s.length
| ^~~~~~~~~~~~
a.cc:47:12: error: too many decimal points in number
47 | for i in 0...(n/5)
| ^~~~
a.cc:50:14: error: too many decimal points in number
50 | for j in 0...5
| ^~~~~
a.cc:1:1: error: 'mp' does not name a type
1 | mp = {}
| ^~
a.cc:2:1: error: 'mp' does not name a type
2 | mp[" "] = "101"
| ^~
|
s800469886 | p00088 | C++ | #include<stdio.h>
#include<string.h>
#define SIGN_LENGTH 8
#define CIPHER_NUM 32
#define NUL 0x00
typedef struct cipher
{
char charcter_change_sign[SIGN_LENGTH];
char sign_change_charcter[SIGN_LENGTH];
char charcter;
}CIPHER;
#define TEXT_MAX 100
int main(void)
{
short i = 0;
short j = 0;
short text_length = 0;
char input_text[TEXT_MAX];
CIPHER code[CIPHER_NUM] = {
{"100101","00000",'A'},
{"10011010","00001",'B'},
{"0101","00010",'C'},
{"0001","00011",'D'},
{"110","00100",'E'},
{"01001","00101",'F'},
{"10011011","00110",'G'},
{"010000","00111",'H'},
{"0111","01000",'I'},
{"10011000","01001",'J'},
{"0110","01010",'K'},
{"00100","01011",'L'},
{"10011001","01100",'M'},
{"10011110","01101",'N'},
{"00101","01110",'O'},
{"111","01111",'P'},
{"10011111","10000",'Q'},
{"1000","10001",'R'},
{"00110","10010",'S'},
{"00111","10011",'T'},
{"10011100","10100",'U'},
{"10011101","10101",'V'},
{"000010","10110",'W'},
{"10010010","10111",'X'},
{"10010011","11000",'Y'},
{"10010000","11001",'Z'},
{"101","11010",' '},
{"010001","11011",'.'},
{"000011","11100",','},
{"10010001","11101",'-'},
{"000000","11110",'\''},
{"000001","11111",'?'}
};
char barcode[801];
char code_fivecut[160][5];
for(i = 0; i < TEXT_MAX; i++)
{
input_text[i] = NUL;
}
for(i = 0; i < 801; i++)
{
barcode[i] = NUL;
}
for(i = 0; i < 160;i++)
{
for(j = 0; j < 5; j++)
{
code_fivecut[i][j] = '0';
}
}
while(gets(input_text) != NULL)
{
for(i = 0; i < TEXT_MAX; i++)
{
text_length++;
if(input_text[i] == NUL)
{
break;
}
}
//printf("text_length=%d\n",text_length);
for(i = 0; i < text_length; i++)
{
for(j = 0; j < CIPHER_NUM; j++)
{
if(input_text[i] == code[j].charcter)
{
strcat(barcode, code[j].charcter_change_sign);
}
}
}
//printf("barcode = %s\n",barcode);
int barcode_length = 0;
for(i = 0; i < 801; i++)
{
barcode_length++;
if( barcode[barcode_length] == '\0')
{
break;
}
}
//printf("barcode_length =%d\n", barcode_length);
int c = 0;
for(i = 0; i < barcode_length; i++)
{
for(j = 0; j < 5; j++)
{
if(c < barcode_length)
{
code_fivecut[i][j] = barcode[c];
c++;
//printf("c=%d\n",c);
}
}
}
int count=0;
for(i = 0;i < 800 ; i+= 5)
{
if(barcode_length <= i)
{
count = i / 5;
break;
}
}
//printf("count= %d\n",count);
/*
for(i = 0; i < count; i++)
{
for(j = 0; j < 5; j++)
{
printf("a = %c",code_fivecut[i][j]);
}
printf("\n");
}*/
int k = 0;
int l = 0;
int cc = 0;
for(i = 0; i < count; i++)
{
for(k = 0; k < CIPHER_NUM; k++)
{
for(l = 0; l < 5; l++)
{
if(code_fivecut[i][l] == code[k].sign_change_charcter[l])
{
cc++;
}
}
if(cc == 5)
{
printf("%c",code[k].charcter);
}
cc = 0;
}
}
printf("\n");
count = 0;
barcode_length = 0;
text_length = 0;
for(i = 0; i < TEXT_MAX; i++)
{
input_text[i] = NUL;
}
for(i = 0; i < 801; i++)
{
barcode[i] = NUL;
}
for(i = 0; i < 160;i++)
{
for(j = 0; j < 5; j++)
{
code_fivecut[i][j] = '0';
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
26 | {"10011010","00001",'B'},
| ^~~~~~~~~~
a.cc:31:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
31 | {"10011011","00110",'G'},
| ^~~~~~~~~~
a.cc:34:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
34 | {"10011000","01001",'J'},
| ^~~~~~~~~~
a.cc:37:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
37 | {"10011001","01100",'M'},
| ^~~~~~~~~~
a.cc:38:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
38 | {"10011110","01101",'N'},
| ^~~~~~~~~~
a.cc:41:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
41 | {"10011111","10000",'Q'},
| ^~~~~~~~~~
a.cc:45:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
45 | {"10011100","10100",'U'},
| ^~~~~~~~~~
a.cc:46:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
46 | {"10011101","10101",'V'},
| ^~~~~~~~~~
a.cc:48:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
48 | {"10010010","10111",'X'},
| ^~~~~~~~~~
a.cc:49:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
49 | {"10010011","11000",'Y'},
| ^~~~~~~~~~
a.cc:50:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
50 | {"10010000","11001",'Z'},
| ^~~~~~~~~~
a.cc:54:18: error: initializer-string for 'char [8]' is too long [-fpermissive]
54 | {"10010001","11101",'-'},
| ^~~~~~~~~~
a.cc:80:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
80 | while(gets(input_text) != NULL)
| ^~~~
| getw
|
s620718638 | p00088 | C++ | import Debug.Trace
charToCode :: Char -> String
charToCode c = case c of
' ' ->"101"
'\''->"000000"
',' ->"000011"
'-' ->"10010001"
'.' ->"010001"
'?' ->"000001"
'A' ->"100101"
'B' ->"10011010"
'C' ->"0101"
'D' ->"0001"
'E' ->"110"
'F' ->"01001"
'G' ->"10011011"
'H' ->"010000"
'I' ->"0111"
'J' ->"10011000"
'K' ->"0110"
'L' ->"00100"
'M' ->"10011001"
'N' ->"10011110"
'O' ->"00101"
'P' ->"111"
'Q' ->"10011111"
'R' ->"1000"
'S' ->"00110"
'T' ->"00111"
'U' ->"10011100"
'V' ->"10011101"
'W' ->"000010"
'X' ->"10010010"
'Y' ->"10010011"
'Z' ->"10010000"
codeToChar :: String->Char
codeToChar s = case s of
"00000"->'A'
"00001"->'B'
"00010"->'C'
"00011"->'D'
"00100"->'E'
"00101"->'F'
"00110"->'G'
"00111"->'H'
"01000"->'I'
"01001"->'J'
"01010"->'K'
"01011"->'L'
"01100"->'M'
"01101"->'N'
"01110"->'O'
"01111"->'P'
"10000"->'Q'
"10001"->'R'
"10010"->'S'
"10011"->'T'
"10100"->'U'
"10101"->'V'
"10110"->'W'
"10111"->'X'
"11000"->'Y'
"11001"->'Z'
"11010"->' '
"11011"->'.'
"11100"->','
"11101"->'-'
"11110"->'\''
"11111"->'?'
solve :: String -> String
solve s = solve' code'
where code = concat $ map charToCode s
mod5 = (length code) `mod` 5
n0 = if mod5==0 then 0 else (5-mod5)
code' = code ++ (take n0 $ repeat '0')
solve' :: String -> String
solve' "" = ""
solve' code' = (codeToChar x):(solve' xs)
where x = take 5 code'
xs = drop 5 code'
main :: IO ()
main = do
str <- getContents
mapM_ putStrLn $ map solve $ lines $ str | a.cc:74:16: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
74 | solve s = solve' code'
| ^~~~~~~
a.cc:76:32: error: stray '`' in program
76 | mod5 = (length code) `mod` 5
| ^
a.cc:76:36: error: stray '`' in program
76 | mod5 = (length code) `mod` 5
| ^
a.cc:78:15: warning: multi-character literal with 29 characters exceeds 'int' size of 4 bytes
78 | code' = code ++ (take n0 $ repeat '0')
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:78:47: warning: missing terminating ' character
78 | code' = code ++ (take n0 $ repeat '0')
| ^
a.cc:78:47: error: missing terminating ' character
78 | code' = code ++ (take n0 $ repeat '0')
| ^~
a.cc:80:6: warning: missing terminating ' character
80 | solve' :: String -> String
| ^
a.cc:80:6: error: missing terminating ' character
80 | solve' :: String -> String
| ^~~~~~~~~~~~~~~~~~~~~
a.cc:81:6: warning: missing terminating ' character
81 | solve' "" = ""
| ^
a.cc:81:6: error: missing terminating ' character
81 | solve' "" = ""
| ^~~~~~~~~
a.cc:82:6: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
82 | solve' code' = (codeToChar x):(solve' xs)
| ^~~~~~~
a.cc:82:37: warning: missing terminating ' character
82 | solve' code' = (codeToChar x):(solve' xs)
| ^
a.cc:82:37: error: missing terminating ' character
82 | solve' code' = (codeToChar x):(solve' xs)
| ^~~~~
a.cc:83:26: warning: missing terminating ' character
83 | where x = take 5 code'
| ^
a.cc:83:26: error: missing terminating ' character
a.cc:84:27: warning: missing terminating ' character
84 | xs = drop 5 code'
| ^
a.cc:84:27: error: missing terminating ' character
a.cc:1:1: error: 'import' does not name a type
1 | import Debug.Trace
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.