|
|
back to boardfor c++ ones: >AC< ;) #include <stdio.h> #include <math.h> double k1, k2, k3; int main() { scanf("%lf%lf%lf", &k1, &k2, &k3); printf("%.0lf", 1000/(k2/k3+k2/k1+1)*k2); return 0; } Re: for c++ ones: >AC< ;) Posted by And IV 3 Feb 2008 04:35 WHY "CE" IN GCC(linux) it works. #include <iostream> #include <math.h> double a,b,c,r; using namespace std; int main() { cin>>a>>b>>c; r=1000.0/(1.0/b+1.0/c+1.0/a); cout<<int(round(r)); return 0; } Re: for c++ ones: >AC< ;) Because here's compiler don't know function round, you must write your own function, and you can use printf() it will round the number Edited by author 19.08.2010 11:47 Re: for c++ ones: >AC< ;) #include <iostream> using namespace std; #include <cmath> void main() { double k1,k2,k3; cin>>k1>>k2>>k3; cout.setf(ios::fixed); cout.precision(0); cout<<1000.0*k1*k2*k3/(k1*k2+k1*k3+k2*k3); } Re: for c++ ones: >AC< ;) Posted by ACSpeed 28 Nov 2011 17:22 #include <iomanip> cout<<fixed<<setprecision(0)<<s; Re: for c++ ones: >AC< ;) ruby a1,a2,a3 = gets.chomp!.split(" ").map(&:to_f) puts (1000*a2/(a2/a1+a2/a3+1)).round |
|
|