假期编程
Posted ping2yingshi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了假期编程相关的知识,希望对你有一定的参考价值。
1.A/B?()
题目链接:
Problem Description
正整数A是否能被正整数B整除,不知道为什么xhd会研究这个问题,来帮帮他吧。
Input
输入数据的第一行是一个数据T,表示有T组数据。
每组数据有两个正整数A和B(A,B<10^9)。
每组数据有两个正整数A和B(A,B<10^9)。
Output
对于每组输入数据,输出"YES"表示可以被整除,"NO"表示不能被整除。
Sample Input
2
4 2
5 3
Sample Output
YES
NO
题解:
方法:整除。
思想:利用两个整数相除,余数为零做这道题。
代码如下:
#include<stdio.h> #include<math.h> #include<stdlib.h> #include<string.h> int main(void) { int n; scanf("%d",&n); while(n>0) { int A; int B; scanf("%d %d",&A,&B); if(A%B==0) printf("YES"); else printf("NO"); printf(" "); n--; } return 0; }
2.Max Num
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2071
Problem Description
There are some students in a class, Can you help teacher find the highest student .
Input
There are some cases. The first line contains an integer t, indicate the cases; Each case have an integer n ( 1 ≤ n ≤ 100 ) , followed n students’ height.
Output
For each case output the highest height, the height to two decimal plases;
Sample Input
2
3 170.00 165.00 180.00
4 165.00 182.00 172.00 160.00
Sample Output
180.00
182.00
http://acm.hdu.edu.cn/showproblem.php?pid=2071
以上是关于假期编程的主要内容,如果未能解决你的问题,请参考以下文章