摘要: sortTime Limit: 6000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16968Accepted Submission(s): 4977Problem Description给你n个整数,请按从大到小的顺序输出其中前m大的数。Input每组测试数据有两行,第一行有两个数n,m(0<n,m<1000000),第二行包含n个各不相同,且都处于区间[-500000,500000]的整数。Output对每组测试数据按从大到小的顺序输出前m大的数。Samp 阅读全文
posted @ 2012-07-26 16:30 zh yu 阅读(273) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The 阅读全文
posted @ 2012-07-26 14:50 zh yu 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 1 //快速幂取模, 2 #include <iostream> 3 4 using namespace std; 5 //1. 6 //a^n%b 7 int modExp(int a, int n, int b) 8 { 9 int t,y;10 t=1;y=a;11 while (n)12 {13 if (n&1) t=t*y%b;//若n为偶数;14 y=y*y%b;15 n>>=1;16 }17 return t;18 }19 //2.利用a^n%c = (((a%c)*a)%c...... 阅读全文
posted @ 2012-07-26 10:42 zh yu 阅读(211) 评论(0) 推荐(0) 编辑