結果

問題 No.403 2^2^2
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-07-23 00:20:14
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,294 bytes
コンパイル時間 642 ms
コンパイル使用メモリ 81,564 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-24 03:15:03
合計ジャッジ時間 4,458 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,448 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
      |            ^

ソースコード

diff #

#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;
}
0