Codeforces Beta Round #30 (Codeforces format)
はい。
http://codeforces.com/contest/30
A. Accounting
brute force,math
ざっくりと大意
・なんか数式が成り立つように?
・基本は(B/A)の(1/n)乗、AやBが0の時に要別処理
方針のようなもの
・式が成り立つように?
Codeforces Beta Round #30 (Codeforces format)
はい。
http://codeforces.com/contest/30
A. Accounting
brute force,math
ざっくりと大意
・なんか数式が成り立つように?
・基本は(B/A)の(1/n)乗、AやBが0の時に要別処理
方針のようなもの
・式が成り立つように?
3785989のftiaschさんを見つつif分岐とかはちょと変えたけど、まぁほぼまるまるパクリ。
#!/usr/bin/env python # -*- coding: UTF-8 -*- import time import sys, io import re, math start = time.clock() (A,B,n)=map(int, raw_input().split()) ans='No solution' if A==0: if B==0: ans=0 else: if B%A==0: c=B/A if c>=0 or n%2!=0: i=(int)(round(pow(abs(c),1.0/n)*(1,-1)[c<0])) if A* pow(i,n)==B: ans=i print ans