結果
| 問題 |
No.403 2^2^2
|
| ユーザー |
|
| 提出日時 | 2020-02-23 07:18:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 369 bytes |
| コンパイル時間 | 576 ms |
| コンパイル使用メモリ | 66,688 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-10 01:34:29 |
| 合計ジャッジ時間 | 1,805 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 9 |
コンパイルメッセージ
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*a%m,b/2,m)*(b%2?a:1)%m:1;}
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;
}