習題評測地址:http://ybt.ssoier.cn:8088ios
計算兩個雙精度浮點數a和b的相除的餘數,a和b都是正數的。這裏餘數(r)的定義是:a = k * b + r,其中 k是整數, 0 <= r < b。ide
輸入僅一行,包括兩個雙精度浮點數a和b。spa
輸出也僅一行,a÷b的餘數。3d
73.263 0.9973code
0.4601blog
#include <iostream> #include <cstdio> using namespace std; int main(){ double a,b; cin>>a>>b; printf("%g",a-b*int(a/b)); return 0; }
#include<iostream> #include<cstdio> using namespace std; int main(){ const double PI = 3.14; double r; cin>>r; printf("%.2lf\n",4/3.0*PI*r*r*r); return 0; }
#include <iostream> using namespace std; int main(){ int n; cin>>n; int a,b,c; a=n/100; b=n%100/10; c=n%100%10; cout<<c<<b<<a<<endl; return 0; }
#include <iostream> #include <cmath> using namespace std; int main(){ const double PI=3.1415926; int h,r; // h深 r:半徑 int l = 20000; int s; //輸出值 cin>>h>>r; double v = PI*r*r*h; s=ceil(l/v); cout<<s<<endl; return 0; }
#include <iostream> #include <cmath> using namespace std; int main(){ double xa,ya,xb,yb; cin>>xa>>ya>>xb>>yb; printf("%.3lf",sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb))); return 0; }
#include <iostream> #include <cmath> using namespace std; int main(){ double x1,y1,x2,y2,x3,y3,s,p,l1,l2,l3; cin>>x1>>y1>>x2>>y2>>x3>>y3; l1=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); l2=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)); l3=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3)); p=(l1+l2+l3)/2.0; printf("%.2lf",sqrt(p*(p-l1)*(p-l2)*(p-l3))); return 0; }
#include <iostream> using namespace std; int main(){ long long a,b,c; cin>>a>>b; c=a*b; cout<<c<<endl; return 0; }
#include <iostream> using namespace std; int main(){ long n; cin>>n; cout<<(1<<n)<<endl; return 0; }
#include <iostream> #include <cmath> using namespace std; int main(){ int n; float x,y; cin>>n>>x>>y; cout<<n-ceil(y/x)<<endl; return 0; }