結果
| 問題 |
No.403 2^2^2
|
| コンテスト | |
| ユーザー |
srup٩(๑`н´๑)۶
|
| 提出日時 | 2016-07-23 00:20:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,294 bytes |
| コンパイル時間 | 897 ms |
| コンパイル使用メモリ | 81,952 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2024-11-06 10:02:53 |
| 合計ジャッジ時間 | 4,385 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 1 WA * 8 TLE * 1 -- * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:18: warning: ‘c’ may be used uninitialized in this function [-Wmaybe-uninitialized]
29 | ll a, b, c;
| ^
main.cpp:29:15: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
29 | ll a, b, c;
| ^
main.cpp:29:12: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized]
29 | ll a, b, c;
| ^
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
const int mod = 1e9 + 7;
int main(void){
ll a, b, c;
string s; cin >> s;
int l = 0, cnt = 0;
for (int i = 0; i < s.size(); ++i){
if(s[i] != '^' && i != s.size() - 1) continue;
else{
if(i == s.size() - 1) i++;
string tmp = s.substr(l, i - l);
if(cnt == 0)a = stod(tmp);
else if(cnt == 1) b = stod(tmp);
else c = stod(tmp);
cnt++; l = i + 1;
}
}
long long ans1tmp = 1, ans1 = 1;
rep(i, b){
ans1tmp *= (a % mod);
ans1tmp %= mod;
}
rep(i, c){
ans1 *= (ans1tmp % mod);
ans1 %= mod;
}
long long ans2tmp = 1, ans2 = 1;
rep(i, c){
ans2tmp *= (b % mod);
ans2tmp %= mod;
}
rep(i, a){
ans2 *= (ans2tmp % mod);
ans2 %= mod;
}
printf("%lld %lld\n", ans1 % mod, ans2 % mod);
return 0;
}
srup٩(๑`н´๑)۶