导航

上一页 1 2 3 4 5 6 7 8 9 10 ··· 15 下一页

2013年8月16日

摘要: 点击打开链接士兵杀敌(一)时间限制:1000ms | 内存限制:65535KB难度:3描述南将军手下有N个士兵,分别编号1到N,这些士兵的杀敌数都是已知的。小工是南将军手下的军师,南将军现在想知道第m号到第n号士兵的总杀敌数,请你帮助小工来回答南将军吧。注意,南将军可能会问很多次问题。输入只有一组测试数据第一行是两个整数N,M,其中N表示士兵的个数(1int soldier[1000001];int main(){ int m , n; int num; int a , b; scanf("%d %d" , &n , &m); soldier[0] = 0; 阅读全文

posted @ 2013-08-16 12:50 勇敢的炮灰 阅读(343) 评论(0) 推荐(0)

摘要: 点击打开链接背包问题时间限制:3000ms | 内存限制:65535KB难度:3描述现在有很多物品(它们是可以分割的),我们知道它们每个物品的单位重量的价值v和重量w(1#includetypedef struct NODE{ int v , w;}Node;Node array[11];int comp(const void *a , const void * b){ return (*(Node *)b).v - (*(Node *)a).v ;}int main(){ int i; scanf("%d" , &i); while(i--) { int a , 阅读全文

posted @ 2013-08-16 12:46 勇敢的炮灰 阅读(418) 评论(0) 推荐(0)

2013年8月15日

摘要: 点击打开链接九的余数时间限制:3000ms | 内存限制:65535KB难度:3描述现在给你一个自然数n,它的位数小于等于一百万,现在你要做的就是求出这个数整除九之后的余数。输入第一行有一个整数m(1char str[1000100];int main(){ int num; int sum; int i; scanf("%d" , &num); getchar(); while(num--) { sum = 0; scanf("%s" , str); for(i = 0 ; str[i] ; i++) { sum += str[i] -  阅读全文

posted @ 2013-08-15 15:15 勇敢的炮灰 阅读(165) 评论(0) 推荐(0)

摘要: 点击打开链接D.D-CityDescriptionLuxer is a really bad guy. He destroys everything he met.One day Luxer went to D-city. D-city has N D-points and M D-lines. Each D-lineconnects exactly two D-points. Luxer will destroy all the D-lines. The mayor of D-city wantsto know how many connected blocks of D-city left 阅读全文

posted @ 2013-08-15 14:25 勇敢的炮灰 阅读(168) 评论(0) 推荐(0)

摘要: 点击打开链接A+B Problem II时间限制:3000ms | 内存限制:65535KB难度:3描述I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.A,B must be positive.输入The first line of the input contains an integer T(1#include#include#include using namespace std;char str[2][1002];int 阅读全文

posted @ 2013-08-15 13:57 勇敢的炮灰 阅读(121) 评论(0) 推荐(0)

摘要: A. TutorDescriptionLilin was a student of Tonghua Normal University. She is studying at University ofChicago now. Besides studying, she worked as a tutor teaching Chinese to Americans. So,she can earn some money per month. At the end of the year, Lilin wants to know hisaverage monthly money to decid 阅读全文

posted @ 2013-08-15 13:46 勇敢的炮灰 阅读(178) 评论(0) 推荐(0)

摘要: /*高精度除低精度求商模板*//*大数除法 ------除数为int范围*/#include#define N 1000using namespace std;void division(char * src,int n){ int len = strlen(src),i,k,t=0,s=0; char dest[N]; bool flag = true; //商是否有了第一个有效位,防止商首部一直出现0 for(i=0,k=0; i0 || t==0) //余数为0要修改商 { dest[k++] = t... 阅读全文

posted @ 2013-08-15 12:35 勇敢的炮灰 阅读(197) 评论(0) 推荐(0)

2013年8月14日

摘要: 点击打开链接次方求模时间限制:1000ms | 内存限制:65535KB难度:3描述求a的b次方对c取余的值输入第一行输入一个整数n表示测试数据的组数(nint f(int a, int b , int c){ if(b == 1) return a % c; long long num; num = f(a , b/2 , c); if(b % 2 == 1) num = ((num * num % c) * a) % c; else num = (num * num) % c; return num;}int main(){ int num; int a , b , c; scan... 阅读全文

posted @ 2013-08-14 16:29 勇敢的炮灰 阅读(107) 评论(0) 推荐(0)

摘要: 点击打开链接单词拼接时间限制:3000ms | 内存限制:65535KB难度:5描述给你一些单词,请你判断能否把它们首尾串起来串成一串。前一个单词的结尾应该与下一个单词的道字母相同。如alohadogarachnidgophertigerrat可以拼接成:aloha.arachnid.dog.gopher.rat.tiger输入第一行是一个整数N(0#include#include#include#include#include#includeusing namespace std;vector > v[26];int agree_in[26];int agree_out[26];int 阅读全文

posted @ 2013-08-14 16:20 勇敢的炮灰 阅读(121) 评论(0) 推荐(0)

摘要: 点击打开链接兄弟郊游问题时间限制:3000ms | 内存限制:65535KB难度:2描述兄弟俩骑车郊游,弟弟先出发,每分钟X米,M分钟后,哥哥带一条狗出发。以每分钟Y米的速度去追弟弟,而狗则以每分钟Z米的速度向弟弟跑去,追上弟弟后又立即返回,直到哥哥追上弟弟时,狗跑了多少米?输入第一行输入一个整数N,表示测试数据的组数(Nint main(){ int num; scanf("%d" , & num); while(num--) { int m , x , y , z; scanf("%d %d %d %d" , &m , &x 阅读全文

posted @ 2013-08-14 14:38 勇敢的炮灰 阅读(129) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 15 下一页