ამოხსნების სტატუსი

ამ გვერდზე თქვენ იხილავთ გაგზავნილი ამოხსნების სტატუსს.


გაგზავნის თარიღი: 16.06.2019 13:44:27

ამოცანა: კლებადი უბნები

მომხმარებელი: mariam_ts

ვერდიქტი: ამოუხსნელი

შეფასება: 0 ქულა







#include <iostream>

int numPartitions(long num) {
    int res = 0;
    int curVal = -1;
    int curLength = 0;
    while(num > 9) {
        if(num % 10 > curVal) {
            curLength++;
            
        } else {
            if(curLength > 2) {
                res++;
            }
        }
        curVal = num % 10;
        num /= 10;
    }
    return res;
}

int main() {
    long num;
    cin>>num;
    cout<<numPartitions(num)<<endl;
    return 0;
}
PROB_cpp_UID501PID145_d3c30b/main.cpp: In function 'int main()':
PROB_cpp_UID501PID145_d3c30b/main.cpp:24:5: error: 'cin' was not declared in this scope
     cin>>num;
     ^~~
PROB_cpp_UID501PID145_d3c30b/main.cpp:24:5: note: suggested alternative:
In file included from PROB_cpp_UID501PID145_d3c30b/main.cpp:1:0:
/usr/include/c++/6/iostream:60:18: note:   'std::cin'
   extern istream cin;  /// Linked to standard input
                  ^~~
PROB_cpp_UID501PID145_d3c30b/main.cpp:25:5: error: 'cout' was not declared in this scope
     cout<<numPartitions(num)<<endl;
     ^~~~
PROB_cpp_UID501PID145_d3c30b/main.cpp:25:5: note: suggested alternative:
In file included from PROB_cpp_UID501PID145_d3c30b/main.cpp:1:0:
/usr/include/c++/6/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^~~~
PROB_cpp_UID501PID145_d3c30b/main.cpp:25:31: error: 'endl' was not declared in this scope
     cout<<numPartitions(num)<<endl;
                               ^~~~
PROB_cpp_UID501PID145_d3c30b/main.cpp:25:31: note: suggested alternative:
In file included from /usr/include/c++/6/iostream:39:0,
                 from PROB_cpp_UID501PID145_d3c30b/main.cpp:1:
/usr/include/c++/6/ostream:590:5: note:   'std::endl'
     endl(basic_ostream<_CharT, _Traits>& __os)
     ^~~~