Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- const ll M = 1e9 + 7;
- const ll inv = 333333336;
- ll pow(ll x, ll y) {
- if(y == 0) return 1;
- ll res = 1;
- while(y > 0) {
- if(y % 2 == 0) {
- x = x * x % M;
- y /= 2;
- }
- else {
- res = res * x % M;
- y--;
- }
- }
- return res;
- }
- int main() {
- int tc; cin >> tc;
- while(tc--) {
- ll x; cin >> x;
- cout << pow(10,x) * inv % M << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement