1 solutions
-
0
C :
#include<stdio.h> int main (){ float n; int s,i,j,k,num; while(scanf("%f",&n)!=EOF){ num = 0; n*=10; s=1000 - n; i=s/100; k=s%10; j=(s-i*100-k)/10; num+=i; num+=j; num+=k; printf("%d\n",num); } return 0; }C++ :
#include <cstdio> int a, b, ans; int main() { while(~scanf("%d.%d", &a, &b)) { ans = 0; a = 1000 - a * 10 - b; while(a) { ans += a % 10; a /= 10; } printf("%d\n", ans); } }
- 1
Information
- ID
- 19515
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By