結果
| 問題 |
No.1161 Many Powers
|
| ユーザー |
|
| 提出日時 | 2020-08-20 03:25:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 620 bytes |
| コンパイル時間 | 771 ms |
| コンパイル使用メモリ | 93,108 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-12 15:24:56 |
| 合計ジャッジ時間 | 2,358 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 13 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
long long a, b, c;
cin >> a >> b >> c;
long long ans = 0;
for (long long i = 1; i < c; i++) {
long long x = i;
long long y = b;
long long z = 1;
while (y > 0) {
if ((y & 1) == 1) {
z = z * x % c;
}
x = x * x % c;
y >>= 1;
}
ans += (a + i) / c * z;
ans %= c;
}
cout << ans << endl;
}