
算法练习
文章平均质量分 57
hubayi31072
这个作者很懒,什么都没留下…
展开
-
hpu 1032
1032: 字母的个数 [水题]时间限制: 1 Sec 内存限制: 128 MB提交: 303 解决: 81 状态题目描述给定一个只有小写字母和数字组成的字符串,问字符串中小写字母的个数。输入第一行输入一个整数TT,代表有TT组测试数据。每组数据输入一个字符串strstr。注:1=T=100,1=|str|=100001。原创 2017-03-23 09:18:10 · 361 阅读 · 0 评论 -
同余定理的应用
求余数题目描述现在给你一个自然数n,它的位数小于等于一百万,现在你要做的就是求出这个数除10003之后的余数。输入第一行有一个整数m(1随后m行每行有一个自然数n。输出输出n整除10003之后的余数,每次输出占一行。样例输入345465456541样例输出456948 题目分析本题主要考查同余定理的性质及推导。根据同余原创 2017-07-21 10:50:48 · 742 阅读 · 0 评论 -
L - Large Division
Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a = b * c.原创 2017-07-21 17:48:59 · 237 阅读 · 0 评论 -
D - 最小公倍数
给定两个正整数,计算这两个数的最小公倍数。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。 Sample Input10 14Sample Output70#includeint gcd(int a,int b){return原创 2017-07-21 22:14:14 · 199 阅读 · 0 评论 -
B - Cake
一次生日Party可能有p人或者q人参加,现准备有一个大蛋糕.问最少要将蛋糕切成多少块(每块大小不一定相等),才能使p人或者q人出席的任何一种情况,都能平均将蛋糕分食. Input每行有两个数p和q. Output输出最少要将蛋糕切成多少块. Sample Input2 3Sample Output4 Hint将蛋糕原创 2017-07-21 22:25:23 · 221 阅读 · 0 评论 -
J - *Wet Shark and Bishops
点击打开链接Today, Wet Shark is given n bishops on a 1000 by 1000 grid. Both rows and columns of the grid are numbered from 1 to 1000. Rows are numbered from top to bottom, while columns are numbe原创 2017-07-24 20:35:15 · 194 阅读 · 0 评论 -
K - *Restoring Painting
点击打开链接Vasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was stolen while he was on duty. He doesn't want to be fired, so he has to quickly restore th原创 2017-07-24 21:27:57 · 254 阅读 · 0 评论 -
[codeforce 347 C. Alice and Bob]
点击打开链接C. Alice and Bobtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt is so boring in the summer holiday, isn't it? So Alice and Bob have inven...原创 2018-03-18 21:01:00 · 306 阅读 · 0 评论 -
AtCoder - 2271-Lining Up
点击打开链接C - Lining UpTime limit : 2sec / Memory limit : 256MBScore : 300 pointsProblem StatementThere are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they...原创 2018-03-13 22:04:59 · 291 阅读 · 0 评论