Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ll x, y, k ;
- cin >> x >> y >> k ;
- cout<<x / y <<".";
- string s ;
- ll rem = x % y ;
- for (int i = 1 ; i<= k + 1 ; i++)
- {
- rem *= 10 ;
- int c = rem / y ;
- s += (char)(c + '0') ;
- rem %= y ;
- }
- if (s.back() >= '5')
- s[s.size() - 2]++;
- s.pop_back() ;
- cout<<s<<"\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement