HDU 2035 不忍直视的水

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF){
		if(!a&&!b) break;
		int ans=1;
		for(int i=1;i<=b;i++)
		ans=(ans*a)%1000;
		printf("%d\n",ans);
	}
	return 0;
}

  

时间: 2024-11-12 17:36:24

HDU 2035 不忍直视的水的相关文章

简单的dp hdu 数塔(水题)

数塔 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 21314    Accepted Submission(s): 12808 Problem Description 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少

hdu 2053 Switch Game 水题一枚,鉴定完毕

Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10200    Accepted Submission(s): 6175 Problem Description There are many lamps in a line. All of them are off at first. A series of op

HDU 2090 算菜价 --- 水题

/* HDU 2090 算菜价 --- 水题 */ #include <cstdio> int main() { char s[105]; double a, b, sum = 0; while (scanf("%s", s)==1){ scanf("%lf%lf", &a, &b); a *= b; sum += a; } printf("%.1f\n", sum); return 0; }

HDU 2091 空心三角形 --- 水题

/* HDU 2091 空心三角形 --- 水题 */ #include <cstdio> int main() { int kase = 0; char ch; int h, t; //h表示高 while (scanf("%c", &ch) == 1 && ch != '@'){ scanf("%d", &h); if (kase++){ printf("\n"); } getchar(); if

HDU 1050-Moving Tables(水)

Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19364    Accepted Submission(s): 6617 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a

矩阵快速幂AC代码HDU 2035

#include <iostream> using namespace std;const int MOD = 1000;//像这样的一个常量就应该专门定义一下 int PowMod(int a, int n)//a^n%MOD { int ret = 1; while(n) { if(n & 1) ret = ret * a % MOD; //变为二进制,然后就可以专门进行分解计算,十分的方便,要求是结合位运算一同使用 a = a * a % MOD; //这里要求特别的注意,因为是

hdu 2212 DFS(水题)

DFS Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4923    Accepted Submission(s): 3029 Problem Description A DFS(digital factorial sum) number is found by summing the factorial of every digit

hdu 5835 Danganronpa 贪心+水题

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5835 [题意]有n种礼物,每个有ai个,现在开始给每个人发礼物,每人一个普通礼物和神秘礼物,相邻两人的普通礼物必须不同,每个礼物都可以作为神秘礼物/普通礼物,问最多可以发给多少人. [解题思路] 答案肯定是小于等于sum/2,因为每个小朋友得有2礼物.然而数据太水,sum/2也过了. 我们先考虑平凡的礼物,因为平凡的礼物相邻桌子上不能相同,故先把数量最多的礼物相邻的交替用作平凡的礼物. 如果n=3,

hdu 5007(字符串水题)

题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5007 Post Robot Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 327    Accepted Submission(s): 253 Problem Description DT is a big fan of digital