CSES - Datatähti 2023 alku - Results
Submission details
Task:Kertoma
Sender:FenixHongell
Submission time:2022-11-01 22:21:19 +0200
Language:C++11
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:24:23: error: parse error in template argument list
   24 |         cout << "5" < endl<;
      |                       ^~~~~
input/code.cpp:24:21: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
   24 |         cout << "5" < endl<;
      |         ~~~~~~~~~~~ ^ ~~~~~
      |              |        |
      |              |        <unresolved overloaded function type>
      |              std::basic_ostream<char>
In file included from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/char_traits.h:39,
                 from /usr/include/c++/11/ios:40,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from input/code.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:489:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(co...

Code

#include <iostream>
#include <tgmath.h>

using namespace std;

int Count(int a, int b, int c, int d, int e, int f, int g, int h, int j, int k) {
    int num = a+b+c+d+e+f+g+h+j+k;
    return num;
}
int calcd(int num) {
    double digits = 0;
    for (int i = 2; i <= num; 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" << endl;
    }
    else if (a == 1 && b == 1 && c == 1 && d == 0 && e == 0 && f == 0 && g == 0 && h == 0 && j == 0 && k == 0) {
        cout << "5" < endl<;
    }
    else if (a == 1 && b == 0 && c == 1 && d == 0 && e == 0 && f == 0 && g == 0 && h == 1 && j == 0 && k == 0) {
        cout << "6" << endl;
    }
    else if (a == 0 && b == 0 && c == 1 && d == 0 && e == 0 && f == 0 && g == 0 && h == 0 && j == 0 && k == 0) {
        cout << "2" << endl;
    }
    else if (a == 0 && b == 0 && c == 0 && d == 0 && e == 0 && f == 0 && g == 1 && h == 0 && j == 0 && k == 0) {
        cout << "3" << endl;
    }
    else {
        int n = 1;
        while (true) {
            if calcd(n) == Count(a,b,c,d,e,f,g,h,i,j,k) {
                cout << n << endl;
                break;
            }
            n += 1
        }
    }
}