Code Submission Evaluation System Login

HIIT Open 2016

Start:2016-05-28 11:00:00
End:2016-05-28 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2016 - Results
History
2016-05-28 12:19:13
2016-05-28 12:17:45
2016-05-28 12:16:49
2016-05-28 12:15:20
2016-05-28 12:13:46
2016-05-28 12:12:33
2016-05-28 12:11:20
2016-05-28 12:08:38
2016-05-28 12:08:18
2016-05-28 12:06:08
2016-05-28 12:04:53
2016-05-28 12:02:24
2016-05-28 12:00:43
2016-05-28 12:00:07
2016-05-28 11:58:13
2016-05-28 11:56:36
Task:Interesting number
Sender:zah
Submission time:2016-05-28 12:19:13
Language:C++
Status:READY
Result:ACCEPTED

Test results

testverdicttime (s)
#1ACCEPTED0.06 / 1.00details
#2ACCEPTED0.06 / 1.00details

Code

#include <iostream>

using namespace std;

//ios_base::sync_with_stdio(0);
//cin.tie(0);


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    int n;
    int x;
    
    int alkuluvut[1001] = {};
    alkuluvut[1] = 1;
    for(int i=2; i<100; i++) {
        for(int j=i*i; j<1001; j+=i) alkuluvut[j]=1; 
    }    

    
    for(int i=0; i<t; i++) {
        cin >> n;
        for(int j=0; j<n; j++) {
            cin >> x;
            if(x>99){
                if(alkuluvut[x]==0){
                    if(x/100==x%10){ //palindromi
                    
                        cout << x << "\n";
                        //break;                    
                    }
                }
            }
            else if(x>9){
                if(alkuluvut[x]==0){
                    if(x/10==x%10){ 
                    
                        cout << x << "\n";
                        //break;                    
                        }
                }
            } else {
                if(alkuluvut[x]==0){
                        cout << x << "\n";
                        //break;                    
                }
            }
        }
    }
}



Test details

Test 1

Verdict: ACCEPTED

input
1000
9
300 988 956 931 116 3 386 202 ...
8
786 850 344 607 258 3 564 795
7
181 300 325 705 512 972 207
6
919 257 176 534 398 536
9
324 811 467 265 688 191 642 17...
5
7 691 423 512 506
5
705 191 300 735 966
10
134 709 407 211 518 815 444 11...
9
794 476 394 244 671 181 466 92...
6
...
view   save

correct output
3
3
181
919
191
7
191
353
181
929
787
727
7
373
313
2
353
383
787
919
...
view   save

user output
3
3
181
919
191
7
191
353
181
929
787
727
7
373
313
2
353
383
787
919
...
view   save

Test 2

Verdict: ACCEPTED

input
1
100000
72 247 605 249 10 422 594 490 ...
view   save

correct output
191
view   save

user output
191
view   save