摘要: Description妈妈每天都要出去买菜,但是回来后,兜里的钱也懒得数一数,到底花了多少钱真是一笔糊涂帐。现在好了,作为好儿子(女儿)的你可以给她用程序算一下了,呵呵。Input输入含有一些数据组,每组数据包括菜种(字串),数量(计量单位不论,一律为double型数)和单价(double型数,表示... 阅读全文
posted @ 2015-06-04 19:12 Vmetrio 阅读(518) 评论(0) 推荐(0)
摘要: DescriptionThere are N people want to choose the best person. Each person select the best person $a_i$, .John wants to know that who received the most... 阅读全文
posted @ 2015-06-04 19:10 Vmetrio 阅读(339) 评论(0) 推荐(0)
摘要: Description甜甜从小就喜欢画图画,最近他买了一支智能画笔,由于刚刚接触,所以甜甜只会用它来画直线,于是他就在平面直角坐标系中画出如下的图形:甜甜的好朋友蜜蜜发现上面的图还是有点规则的,于是他问甜甜:在你画的图中,我给你两个点,请你算一算连接两点的折线长度(即沿折线走的路线长度)吧。Inpu... 阅读全文
posted @ 2015-06-04 19:08 Vmetrio 阅读(173) 评论(0) 推荐(0)
摘要: Description假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值 2 #include 3 4 int le[30],n1[55],n2[55]; 5 6 ... 阅读全文
posted @ 2015-06-04 18:00 Vmetrio 阅读(250) 评论(0) 推荐(0)
摘要: 为什么 str[]-'0' ?while(cin>>a)//说明读进去的a[i]不是数字,而是字符的形式,如'0','1'...'9',它们的ascii码不是简单的0,1,...9,而是表示为48,49...57所以在你想要得到它们表示的数字,还要减去一个偏移量'0',即48。 阅读全文
posted @ 2015-06-04 17:50 Vmetrio 阅读(146) 评论(0) 推荐(0)
摘要: Description给定一个日期,输出这个日期是该年的第几天。Input输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。Output对于每组输入数据,输出一行,表示该日期是该年的第几天。Sample In... 阅读全文
posted @ 2015-06-04 17:45 Vmetrio 阅读(193) 评论(0) 推荐(0)
摘要: DescriptionToday is Saturday, 17th Nov,2007. Now, if i tell you a date, can you tell me what day it is ? InputThere are multiply cases. One line is on... 阅读全文
posted @ 2015-06-04 17:40 Vmetrio 阅读(353) 评论(0) 推荐(0)
摘要: Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that d... 阅读全文
posted @ 2015-06-04 17:37 Vmetrio 阅读(212) 评论(0) 推荐(0)
摘要: 下面是 m^n % k 的快速幂: 1 // m^n % k 2 int quickpow(int m,int n,int k) 3 { 4 int b = 1; 5 while (n > 0) 6 { 7 if (n & 1) 8 ... 阅读全文
posted @ 2015-06-04 17:34 Vmetrio 阅读(187) 评论(0) 推荐(0)
摘要: DescriptionGiven a positive integer N, you should output the most right digit of N^N. InputThe input contains several test cases. The first line of th... 阅读全文
posted @ 2015-06-04 17:30 Vmetrio 阅读(173) 评论(0) 推荐(0)
摘要: DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the ma... 阅读全文
posted @ 2015-06-04 17:27 Vmetrio 阅读(209) 评论(0) 推荐(0)
摘要: 在网站上一直没有找到有关于快速幂算法的一个详细的描述和解释,这里,我给出快速幂算法的完整解释,用的是C语言,不同语言的读者只好换个位啦,毕竟读C的人较多~所谓的快速幂,实际上是快速幂取模的缩写,简单的说,就是快速的求一个幂式的模(余)。在程序设计过程中,经常要去求一些大数对于某个数的余数,为了得到更... 阅读全文
posted @ 2015-06-04 16:55 Vmetrio 阅读(474) 评论(0) 推荐(0)