随笔分类 -  hdu水题

摘要:题目大意:求学生的GPA,学分成以计分数,再除以分数的总和 思路:先用一个函数求出分数对应的学分,用for循环,每次输入,如果分数不是-1就用sum加上分数所对应的学分和计分的成积 再除以学分的总和, 如果sum等于0;则证明没有学分,就没有GPA,输出-1;还有... 阅读全文
posted @ 2018-04-24 19:13 MCQ 阅读(203) 评论(0) 推荐(0)
摘要:#include #includeusing namespace std;int main(void){ int dec_sum=0,hex_sum=0,duo_sum=0,dec_temp,hex_temp,duo_temp; for(int i=100... 阅读全文
posted @ 2018-04-23 18:12 MCQ 阅读(147) 评论(0) 推荐(0)
摘要:解题思路:考虑两种糖果,假设其中一种最大数量为n,要想这两种糖果交替吃完,则另一种糖果最少的数量为n-1.因为n个糖果排成一排,内部一共有n-1个空,分离相邻的两个相同的糖果。回到题目中,找出某种糖果的最大数量maxvalue,至少需要maxvalue-1个糖果(即除... 阅读全文
posted @ 2018-04-23 18:04 MCQ 阅读(212) 评论(0) 推荐(0)
摘要:细节很多,可以先算365*18再判断其他的情况再分别加一#include #includeusing namespace std;bool ifrun(int n){ if((n%4==0&&n%100!=0) ||n%400==0) return... 阅读全文
posted @ 2018-04-23 00:27 MCQ 阅读(303) 评论(0) 推荐(0)
摘要:第一次交没注意题目说的是实数,改double就行了/*每学期的期末,大家都会忙于计算自己的平均成绩,这个成绩对于评奖学金是直接有关的。国外大学都是计算GPA(grade point average) 又称GPR(grade point ratio),即成绩点数与学分的... 阅读全文
posted @ 2018-04-22 23:25 MCQ 阅读(182) 评论(0) 推荐(0)
摘要:我用优先级队列做的,需要打表不然会超时。注意:1200也是rd所以判断条件应该为n%100!=…/*Sample Input1234111213212223100100058420Sample OutputThe 1st humble number is 1.The ... 阅读全文
posted @ 2018-04-16 16:05 MCQ 阅读(112) 评论(0) 推荐(0)
摘要:/*Sample Input32005 251855 122004 10000Sample Output2108190443236*/#include using namespace std;bool ifrun(int y){ if((y%4==0&&y%10... 阅读全文
posted @ 2018-04-15 23:07 MCQ 阅读(140) 评论(0) 推荐(0)
摘要:水题。找规律,从第二开始每四个/*There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).InputInput consists o... 阅读全文
posted @ 2018-04-14 07:38 MCQ 阅读(87) 评论(0) 推荐(0)
摘要:又是一个坑题,注意求最小公倍数时先除后乘,不然会超范围,然后就wa..../*The least common multiple (LCM) of a set of positive integers is the smallest positive integer ... 阅读全文
posted @ 2018-04-13 22:34 MCQ 阅读(130) 评论(0) 推荐(0)
摘要:水题,没注意大数。。wa无数次#include #includeint main(){ char a[1500]; int sum; while(scanf("%s",&a)!=EOF) { if(strlen(a)==1&&a[... 阅读全文
posted @ 2018-04-13 22:12 MCQ 阅读(66) 评论(0) 推荐(0)
摘要:刚开始这题看起来比较容易,因为直接用递归的话很容易搞定。但是提交的时候总是不AC,仔细一看有很多格式限制,比如内存,运行时间,堆栈大小等的限制。所以递归是行不通的。 在网上查看了一下相关思路,再看看n的范围可以那么大,用一般方法肯定不行,这时候就要想到其中的规律。我们... 阅读全文
posted @ 2018-04-13 22:03 MCQ 阅读(188) 评论(0) 推荐(0)