4_ 고소한 알고리즘
C- ACM - Coin
준환이형님_
2010. 6. 8. 01:38
으음.. 막상 이해하고 나면 /이게 뭐야/ 할지도 ㅋㅋ
Given K 10-won coins, L 50-won coins, M 100-won coins and N 500-won coins, you are to write a program that calculate the total amount.
Input
The input consists of T test cases. The number of test cases T is given in the first line of the input file. Each test case will consist of four integers K, L, M and N (0<K, L, M, N>100). The integers given in a line are separated by a space.
Output
Print exactly one line for each test case. For each test case of K, L, M and N you should output the total amount.
The following shows sample input and output for three test cases.
Sample Input
Output for the Sample Input
3
1 1 1 1
answer : 660
0 1 2 3
answer : 1750
1 2 10 20
answer : 11110
#include <stdio.h>
int main(void)
{
int repeat=NULL;
int K,L,M,N;
scanf("%d",&repeat);
for(int i=0; i<repeat; i++)
{
scanf("%d %d %d %d",&K, &L, &M, &N);
printf("%d\n",K*10+L*50+M*100+N*500);
}
return 0;
}