Skip to content

Commit 399e592

Browse files
committed
Added problem 584B from codeforces
1 parent 2c83f09 commit 399e592

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// http://codeforces.com/contest/584/problem/B
2+
3+
#include<bits/stdc++.h>
4+
using namespace std;
5+
6+
long long md = 1e9 + 7;
7+
8+
long long mpow (long long a, long long b) {
9+
long long p = a;
10+
while (b --> 1) {
11+
p = (p * a) % md;
12+
p %= md;
13+
}
14+
15+
return p % md;
16+
}
17+
18+
int main() {
19+
int n;
20+
cin >> n;
21+
22+
long long a = mpow(3LL, n * 3);
23+
long long b = mpow(7LL, n);
24+
long long tmp = (a + md) - b;
25+
cout << tmp % md;
26+
}

codeforces/data.db

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,4 +677,5 @@
677677
13425589
678678
13463792
679679
13443199
680-
13465613
680+
13465613
681+
13486876

0 commit comments

Comments
 (0)