HDOJ1248 寒冰王座

来源:互联网 发布:mac全灭怎么拖出飞机 编辑:程序博客网 时间:2024/04/29 15:05
Post Code:
//hdoj1248.cpp#include<iostream>using namespace std;int free(int n){    int m;    if(n<200)       m=n%150;//注意n<150时,小费就等于n     else if(n>=200&&n<300)       m=n%200;    else if(n>=300)//n>300时,只要能被50整除的小费都是0;所以用n%50就是小费       m=n%50;           return m;    }    int main(){           int t;           int a[101]={0};           scanf("%d",&t);           for(int i=0;i<t;i++){                 scanf("%d",&a[i]);                 }           for(int j=0;j<t;j++){                 printf("%d\n",free(a[j]));                 }     return 0;              }