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

printf和cout混用,缓冲区不同,一个有,一个没有,出错正常。

Posted by bluewind at 2007-08-15 22:51:45 on Problem 1799
In Reply To:WA 原因WHY! Posted by:123456sb at 2007-08-15 22:41:39
> WA 的!@
> #include<iostream.h>
> #include<stdio.h>
> #include<math.h>
> void main(){
> 	int number,n;
> 	double R,r,temp;
> 	double re[10000];
> 	cin>>number;
> 	for(int i=1;i<=number;i++){
> 		cin>>R>>n;
> 		r=(sin(acos(-1)/n)*R)/(1+sin(acos(-1)/n));
> 		re[i]=r;
> 	}
> 	for(i=1;i<=number;i++){
> 	//printf("Scenario #%d:\n",i);
>     cout<< "Scenario #"<<i<<":"<<endl;
> 	printf("%.3f\n\n",re[i]);
> 	}
> }
> AC 的!@
> #include<iostream.h>
> #include<stdio.h>
> //#define pi 3.14159265358979323846
> #include<math.h>
> void main(){
> 	int number,n;
> 	double R,r,temp;
> 	double re[10000];
> 	cin>>number;
> 	for(int i=1;i<=number;i++){
> 		cin>>R>>n;
> 		r=(sin(acos(-1)/n)*R)/(1+sin(acos(-1)/n));
> 		re[i]=r;
> 	}
> 	for(i=1;i<=number;i++){
> 	printf("Scenario #%d:\n",i);
>     //cout<< "Scenario #"<<i<<":"<<endl;
> 	printf("%.3f\n\n",re[i]);
> 	}
> }
> 

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