Code Submission Evaluation System Login

CSES - HIIT Open 2017

HIIT Open 2017

Contest start:2017-05-27 11:00:00
Contest end:2017-05-27 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard


History
2017-05-27 15:03:28
2017-05-27 15:02:14
2017-05-27 14:44:37
2017-05-27 14:36:14
2017-05-27 14:32:48
Task:Book writing
Sender:IOG
Submission time:2017-05-27 15:03:28
Status:READY
Result:WRONG ANSWER

Show test data

Code

#include <bits/stdc++.h>

using namespace std;


int main(void)
{
 cin.sync_with_stdio(0);
 cin.tie(0);
 long long mod, p;
 
 cin >> p >> mod;
 
 long long res = 1;
 for (int i = 0; i < p-1; i++)
 {
        res = (res*3)%mod;
 }
 

 cout << (int)res << endl;
 

}