codechef APPROX - approximately editorial: http://discuss.codechef.com/questions/7268/approx-editorial
codechef APPROX - approximately solution: http://ideone.com/V5x0Nx
#include <iostream> #include <cstdio> using namespace std; int main() { int t, k, a, b, c; scanf("%d", &t); while(t--) { a=103993, b=33102; scanf("%d", &k); printf("%d", a/b); c=a/b; a=(a-c*b)*10; for(int i=1; i<=k; i++) { if(i==1) printf("."); c=a/b; printf("%d", c); a=(a-c*b)*10; } printf("\n"); } return 0; }
No comments:
Post a Comment