結果
| 問題 |
No.403 2^2^2
|
| コンテスト | |
| ユーザー |
msm1993
|
| 提出日時 | 2021-03-23 15:33:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 383 bytes |
| コンパイル時間 | 526 ms |
| コンパイル使用メモリ | 65,548 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 07:20:10 |
| 合計ジャッジ時間 | 1,622 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
long p(long a,long b,long m){return b?p(a%m*(a%m)%m,b/2,m)*(b%2?a%m:1)%m:a%m?1:0;}
long A,B,C;
main()
{
string s;cin>>s;
int id=0;
while(s[id]!='^')A=A*10+s[id++]-'0';
id++;
while(s[id]!='^')B=B*10+s[id++]-'0';
id++;
while(id<s.size())C=C*10+s[id++]-'0';
long mod=1e9+7;
cout<<p(p(A,B,mod),C,mod)<<" "<<p(A,p(B,C,mod-1),mod)<<endl;
}
msm1993