結果
| 問題 | No.1161 Many Powers |
| ユーザー |
|
| 提出日時 | 2020-09-09 17:56:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 132 ms / 2,000 ms |
| コード長 | 245 bytes |
| 記録 | |
| コンパイル時間 | 873 ms |
| コンパイル使用メモリ | 64,256 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-15 23:08:12 |
| 合計ジャッジ時間 | 2,846 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
long A,B,C;
long power(long a,long b){return b?power(a*a%C,b/2)*(b%2?a:1)%C:1;}
main()
{
cin>>A>>B>>C;
long ans=0;
for(int i=0;i<C;i++)
{
ans+=(A/C+(A%C>=i))%C*power(i,B)%C;
}
cout<<ans%C<<endl;
}