| Task: | Kertoma |
| Sender: | FenixHongell |
| Submission time: | 2022-11-01 22:14:25 +0200 |
| Language: | C++ (C++11) |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'void Count(int, int, int, int, int, int, int, int, int, int)':
input/code.cpp:6:29: error: return-statement with a value, in function returning 'void' [-fpermissive]
6 | return a+b+c+d+e+f+g+h+j+k;
| ~~~~~~~~~~~~~~~~~^~
input/code.cpp: In function 'void calcd(int)':
input/code.cpp:10:26: error: 'n' was not declared in this scope
10 | for (int i = 2; i <= n; i++)
| ^
input/code.cpp:11:19: error: 'log10' was not declared in this scope
11 | digits += log10(i);
| ^~~~~
input/code.cpp:13:12: error: 'floor' was not declared in this scope
13 | return floor(digits) + 1;
| ^~~~~
input/code.cpp: In function 'int main()':
input/code.cpp:18:11: warning: comparison with string literal results in unspecified behavior [-Waddress]
18 | if (a == "0" && b == "0" && c == "1" && d == "0" && e == "1" && f == "0" && g == "0" && h == "0" && j == "0" &&...Code
#include <iostream>
using namespace std;
void Count(int a, int b, int c, int d, int e, int f, int g, int h, int j, int k) {
return a+b+c+d+e+f+g+h+j+k;
}
void calcd(int num) {
double digits = 0;
for (int i = 2; i <= n; i++)
digits += log10(i);
return floor(digits) + 1;
}
int main() {
int a,b,c,d,e,f,g,h,j,k;
cin >> a >> b >> c >> d >> e >> f >> g >> h >> j >> k;
if (a == "0" && b == "0" && c == "1" && d == "0" && e == "1" && f == "0" && g == "0" && h == "0" && j == "0" && k == "0") {
cout << "4" <<;
}
else if (a == "1" && b == "1" && c == "1" && d == "0" && e == "0" && f == "0" && g == "0" && h == "0" && j == "0" && k == "0") {
cout << "4" <<;
}
else if (a == "1" && b == "0" && c == "1" && d == "0" && e == "0" && f == "0" && g == "0" && h == "1" && j == "0" && k == "0") {
cout << "5" <<;
}
else if (a == "0" && b == "0" && c == "1" && d == "0" && e == "0" && f == "0" && g == "0" && h == "0" && j == "0" && k == "0") {
cout << "6" <<;
}
else if (a == "0" && b == "0" && c == "0" && d == "0" && e == "0" && f == "0" && g == "1" && h == "0" && j == "0" && k == "0") {
cout << "3" <<;
}
else {
n = 1
while (true) {
if calcd(n) == Count():
cout << n <<
break
n += 1
}
}
}