NC21686. Carrier
描述
请问tokitsukaze在建造航母时,系统会发出什么提示。
输入描述
第一行包含一个正整数T(T≤100),表示T组数据。
对于每组数据:
第一行包含4个正整数a,b,x,y(1≤a,b≤1000,1≤x≤y≤200)。
输出描述
对于每组数据:
输出一行,表示系统发出的提示。
注意:输出均不含引号。
示例1
输入:
4 300 200 100 105 400 200 100 105 400 300 100 105 400 300 100 106
输出:
You have not enough minerals. You require more vespene gas. You must construct additional pylons. Carrier has arrived.
C++11(clang++ 3.9) 解法, 执行用时: 4ms, 内存消耗: 480K, 提交时间: 2018-12-08 13:11:27
#include<stdio.h> int main(){ int T; scanf("%d",&T); while(T--){ int a,b,x,y; scanf("%d%d%d%d",&a,&b,&x,&y); if(a<350) printf("You have not enough minerals.\n"); else if(b<250) printf("You require more vespene gas.\n"); else if(6+x>y) printf("You must construct additional pylons.\n"); else printf("Carrier has arrived.\n"); } }
C(clang 3.9) 解法, 执行用时: 3ms, 内存消耗: 376K, 提交时间: 2018-12-10 01:35:41
main(){ int t,a,b,x,y; scanf("%d",&t); while(t--){ scanf("%d %d %d %d",&a,&b,&x,&y); if(a<350) printf("You have not enough minerals.\n"); else if(b<250) printf("You require more vespene gas.\n"); else if(x+6>y) printf("You must construct additional pylons.\n"); else printf("Carrier has arrived.\n"); } }
Python3(3.5.2) 解法, 执行用时: 22ms, 内存消耗: 3424K, 提交时间: 2018-12-08 13:26:25
T = int(input()) for cas in range(T): a, b, x, y = map(int, input().split()) if a<350: print('You have not enough minerals.') elif b<250: print('You require more vespene gas.') elif x+6>y: print('You must construct additional pylons.') else: print('Carrier has arrived.')