Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

快速幂才能0ms,暴力16ms

Posted by KatrineYang at 2016-11-06 08:34:15 on Problem 2390
#include <stdio.h>
using namespace std;

double pw(double a, int b){
	if(b==0)return 1.0;
	if(b==1)return a;
	double p = pw(a,b/2);
	double r = p*p;
	if(b%2)return r*a;
	return r;
}

int main() {
	int R,M,Y;
	scanf("%d%d%d",&R,&M,&Y);
	double m = M;
	double r = 1+R/100.0;
	printf("%d\n",(int)(m*pw(r,Y)));
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator