結果
問題 | No.403 2^2^2 |
ユーザー |
|
提出日時 | 2020-02-23 07:22:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 383 bytes |
コンパイル時間 | 555 ms |
コンパイル使用メモリ | 65,024 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 01:34:38 |
合計ジャッジ時間 | 1,470 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; }