人见人爱A^B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 27711 Accepted Submission(s): 18946 Problem Description 求A^B的最后三位数表示的整数. 说明:A^B的含义是"A的B次方" Input 输入数据包含多个测试实例,每个实例占一行,由两个正整 数A和…
同余问题 基本定理: 若a,b,c,d是整数,m是正整数, a = b(mod m), c = d(mod m) a+c = b+c(mod m) ac = bc(mod m) ax+cy = bx+dy(mod m) -同余式可以相加 ac = bd(mod m) -同余式可以相乘 a^n = b^n(mod m) f(a) = f(b)(mod m) if a = b(mod m) and d|m then a = b(mod d) eg: 320 = 20(mod 100) and d =…
2028 Lowest Common Multiple Plus #include<stdio.h> int gcd(int a,int b){ int temp,temp1; if(a<b){ temp = a; a = b; b = temp; } ){ temp1 = a%b; a = b; b = temp1; } return b; } int main(){ int n,s,i; long long k; while(scanf("%d",&n)…
#include <iostream> using namespace std; int main() { long a, b; && b != ) { long result = a; ; i <= b; i++) { result = (result * a) % ; } cout << result % << endl; } ; }…
人见人爱A+B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 30385 Accepted Submission(s): 20250 Problem Description HDOJ上面已经有10来道A+B的题目了,相信这些题目曾经是大家的最爱,希望今天的这个A+B能给大家带来好运,也希望这个题目能唤起大家对ACM曾经的热爱.…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2033 人见人爱A+B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 64329 Accepted Submission(s): 41979 Problem Description HDOJ上面已经有10来道A+B的题目了,相信这些题目…
人见人爱A+B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 45556 Accepted Submission(s): 30150 Problem Description HDOJ上面已经有10来道A+B的题目了,相信这些题目曾经是大家的最爱,希望今天的这个A+B能给大家带来好运,也希望这个题目能唤起大家对ACM曾经的热爱.这个…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 56784 Accepted Submission(s): 19009 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats g…
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3049 Accepted Submission(s): 2364 Problem Description You are the CEO of Nasty Hacks Inc., a company that creates small pieces of…
Box of Bricks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5994 Accepted Submission(s): 2599 Problem Description Little Bob likes playing with his box of bricks. He puts the bricks one up…
Problem Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color…
卧槽....最近刷的cf上有最短路,本来想拿这题复习一下.... 题意就是在输出最短路的情况下,经过每个节点会增加税收,另外要字典序输出,注意a到b和b到a的权值不同 然后就是处理字典序的问题,当松弛时发现相同值的时候,判断两条路径的字典序 代码 #include "stdio.h" const int MAXN=110; const int INF=10000000; bool vis[MAXN]; int pre[MAXN]; int cost[MAXN][MAXN],lowcos…