ACM
onlinewk
这个作者很懒,什么都没留下…
展开
-
hdu (找规律)
由于n值非常大,逐个计算到f(n)肯定会超时。mod7容易想到会有规律可寻。因为mod7的关系,而且f(1)=f(2)=1,所以f(n)的值是循环分布的,而且一定会回到f(n-1)=f(n)=1,[n-1]和f[n-2]的这两个数的组合一共有7*7=49可能(就是两个数字的组合,每个数有7种可能,比如0和1,6和5,4和2)因为相邻连个f只有7种取值。所以,只要找出循环因子即可,寻原创 2014-03-24 12:04:01 · 421 阅读 · 0 评论 -
B - SaleBob 买电视啦!
B -Sale pTime Limit: 2000MSMemory Limit: 262144K64bit IO Format: %I64d& %I64u[Submit] [GoBack] [Status]DescriptionOnce Bob got to a sale of old TV sets. Therewere n TV sets原创 2014-03-24 12:04:54 · 520 阅读 · 0 评论 -
A - Translation字符串匹配问题
A -Translation pTime Limit: 2000MSMemory Limit: 262144K64bit IO Format: %I64d& %I64u[Submit] [GoBack] [Status]DescriptionThe translation from the Berland language into the Bi原创 2014-03-24 12:05:01 · 532 阅读 · 0 评论 -
poj 1005
A - Tothe Max pTime Limit: 1000MSMemory Limit: 10000K64bit IO Format: %I64d& %I64u[Submit] [GoBack] [Status]DescriptionGiven a two-dimensional array of positive andnegative原创 2014-03-24 12:05:03 · 296 阅读 · 0 评论 -
D - Gifts in a Hexagonal Box
D -Gifts in a Hexagonal Box pTime Limit: 3000MSMemory Limit: Unknown64bit IO Format: %lld &%llu[Submit] [GoBack] [Status]DescriptionProblem EGifts in a HexagonalBoxInp原创 2014-03-24 12:05:05 · 439 阅读 · 0 评论 -
Count on Cantor 数表
E -Count on Cantor pTime Limit: 3000MSMemory Limit: Unknown64bit IO Format: %lld &%llu[Submit] [GoBack] [Status]Description Count onCantor One of the famous proofs o原创 2014-03-24 12:05:08 · 474 阅读 · 0 评论 -
hdu 1003 递归(DP)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1003思路是用ret记录当前最大字段和,在主函数中调用max_sum()用star和end来标记当前最大字段和所对应的起始位置,将调用函数的三个参数ret,star,end返回输出即可。#include const int MAX=100005;using namesp原创 2014-03-24 12:05:10 · 353 阅读 · 0 评论 -
hdu 3910 两国杀
推公式:(用偏导数来求)http://acm.hdu.edu.cn/showproblem.php?pid=3910#includeusing namespace std;int main(){ int a,b,c;double point,x;while(scanf("%d%d%d",&a,&b,&c)!=EOF){ x=(b+c)/(a+b+2.0*c); p原创 2014-03-24 12:05:12 · 453 阅读 · 0 评论 -
Emoogle Balance
A- Emoogle Balance pTime Limit: UnknownMemory Limit: Unknown64bit IO Format: %lld &%llu[Submit] [GoBack] [Status]Description We have a very famous and popular fellow in our原创 2014-03-24 12:05:17 · 500 阅读 · 0 评论 -
A - You‘re Given a String
A -You're Given a String... pTime Limit: 2000MSMemory Limit: 262144K64bit IO Format: %I64d& %I64u[Submit] [GoBack] [Status]DescriptionYou're given a string of lower-case Lati原创 2014-03-24 12:05:20 · 515 阅读 · 0 评论 -
Party 生日派对 推公式
B- Party pTime Limit: 2000MSMemory Limit: 262144K64bit IO Format: %I64d& %I64u[Submit] [GoBack] [Status]Descriptionn people came toa party. Then those, who had no friends am原创 2014-03-24 12:05:22 · 474 阅读 · 0 评论 -
Shell Game (类似找骰子游戏)
F- Shell Game pTime Limit: 2000MSMemory Limit: 65536K64bit IO Format: %I64d& %I64u[Submit] [GoBack] [Status]DescriptionToday the «Z» city residents enjoy a shell game competi原创 2014-03-24 12:05:24 · 707 阅读 · 0 评论 -
poj 1002
题目:http://poj.org/problemlist#include#includeusing namespace std;void change(char map[]){ for (int i = 0; i 9; i++) map[i + '0'] = i; map['A'] = map['原创 2014-03-24 12:04:52 · 324 阅读 · 0 评论 -
hdu 2203 亲和串
题目: http://acm.hdu.edu.cn/showproblem.php?pid=2203#includeusing namespace std;int main(){ char s1[100010],s2[100010],s3[200020]; while(gets(s1)) { gets(s2)原创 2014-03-24 12:04:50 · 269 阅读 · 0 评论 -
Rock-paper-scissors 石头剪刀布
F -Rock-paper-scissors pTime Limit: 2000MSMemory Limit: 262144K64bit IO Format: %I64d& %I64u[Submit] [GoBack] [Status]DescriptionUncle Fyodor, Matroskin the Cat and Sharic th原创 2014-03-24 12:04:47 · 1983 阅读 · 0 评论 -
poj 1287
方法一:利用线段、交点、区域的关系,可以推出递推式子f(n)=f(n-1)+9n-8f(0)=1方法二:利用平面Euler公式推出公式f(n)=(9*n+2)*(n-1)/2+2;方法三:猜测公式为2次多项式,然后手算前3个,带入f(x)=ax2+bx+c,求出a,b,c。方法一代码: #includeusing namespacestd;int n;int原创 2014-03-24 12:04:03 · 381 阅读 · 0 评论 -
Fortune Telling 数花瓣--算命
B- Fortune Telling pTime Limit: 2000MSMemory Limit: 262144K64bit IO Format: %I64d& %I64u[Submit] [GoBack] [Status]DescriptionMarina loves Sasha. But she keeps wondering wheth原创 2014-03-24 12:04:06 · 768 阅读 · 0 评论 -
A Word
A - Word pTime Limit: 2000MSMemory Limit: 262144K64bit IO Format: %I64d& %I64u[Submit] [GoBack] [Status]DescriptionVasya is very upset that many people on the Net mix uppercas原创 2014-03-24 12:04:08 · 407 阅读 · 0 评论 -
hdu 2153 仙人球的残影
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2153#includeconst int MAX=10;int a[MAX][MAX];using namespace std;int main(){int n,x,y,tot=0; while(scanf("%d",&n),n>=1&&n{memset(a,0,sizeo原创 2014-03-24 12:04:15 · 414 阅读 · 0 评论 -
hdu 3857
http://acm.hdu.edu.cn/showproblem.php?pid=3857直接看输入输出,题意:找出a[i]=i;i从1开始,注意输出格式最后一个不能有空格#includeusing namespace std;int main(){int n,i,a[10010],b[10010],j,k,count;while(scanf("%d",&n)!=EOF){原创 2014-03-24 12:04:17 · 501 阅读 · 0 评论 -
foj 1402
http://acm.fzu.edu.cn/problem.php?pid=1402Problem 1402 猪的安家Accept:560 Submit:4092Time Limit: 1000mSec MemoryLimit : 32768 KB 1402" TITLE="foj 1402" /> ProblemDescriptionAndy原创 2014-03-24 12:04:19 · 455 阅读 · 0 评论 -
foj 1054 ;可用STL的库函数
Problem 1054 阅读顺序Accept:1532 Submit:3895Time Limit: 1000mSec MemoryLimit : 32768 KB 1054 可用STL的库函数" TITLE="foj 1054 可用STL的库函数" /> ProblemDescription大多数语言是从左向右读的。但是,在一些语言中,阅读顺原创 2014-03-24 12:04:21 · 475 阅读 · 0 评论 -
Divisor Summation约数之和
Divisor SummationDescriptionGive a natural number n (1 <= n <=500000), please tell the summation of all its proper divisors.Definition: A proper divisor of a natural number is the divisorthat原创 2014-03-24 12:04:30 · 964 阅读 · 0 评论 -
Petya and Java strcmp的使用
Petyaand JavaTime Limit: 2000MSMemory Limit: 262144K64bit IO Format: %I64d& %I64uDescriptionLittle Petya has recently started attending a programming club.Naturally he is facing原创 2014-03-24 12:04:37 · 476 阅读 · 0 评论 -
hdu 3679
题目:http://acm.hdu.edu.cn/showproblem.php?pid=3679#includeusing namespace std; int main() { int a[4][1000],b; int n,i,j,count,t; t=0; while(cin>>n)原创 2014-03-24 12:04:41 · 449 阅读 · 0 评论 -
hdu 3677
题目:http://acm.hdu.edu.cn/showproblem.php?pid=3677水 ,只贴代码#include#includeusing namespace std;int main(){ int L,N,i,T,a[10]; int t=0,time; while(cin>>L>>N>>T) {原创 2014-03-24 12:04:43 · 390 阅读 · 0 评论 -
Irrationa problem
A- Irrational problem pTime Limit: 2000MSMemory Limit: 262144K64bit IO Format: %I64d& %I64DescriptionLittle Petya was given this problem for homework:You are given function proble原创 2014-03-24 12:04:45 · 514 阅读 · 0 评论 -
hdu 1042 N!
#include #include #include using namespace std; const int MAX=36900; int f[MAX];int main() { int n,i,s,j; while(scanf("%d",&n)!=EOF) { memset(f,0,sizeof(f));原创 2014-03-24 12:05:32 · 313 阅读 · 0 评论 -
hdu 1066 阶乘最后非0位
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1066// 123456.cpp : 定义控制台应用程序的入口点。#include#include#include#include#includeconst int MAX=1000005;int ans;#define REP(i,n) for(inti=0;iusing n原创 2014-03-24 12:05:34 · 459 阅读 · 0 评论 -
hdu 1021 Fibonacc Again 找规律
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1021#include#include#include#include#include#include#includeusing namespace std;const int MAX=50;#define CL(a,b) memset(a,b,sizeof(a))#defi原创 2014-03-24 12:05:51 · 367 阅读 · 0 评论 -
hdu 2036 改革春风吹满地
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2036多边形面积公式S=0.5 *abs ( (x0*y1-x1*y0) + (x1*y2-x2*y1) + ... +(Xn-1*y0-x0*Yn-1))最后一个要注意加上只有各点是逆时针排列才能这样做#include#include#includeusing namespace std;原创 2014-03-24 12:05:53 · 404 阅读 · 0 评论 -
hdu 2043
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2043#include#include#include#include#include#include#includeusing namespace std;const int MAX=50;#define CL(a,b) memset(a,b,sizeof(a))#defin原创 2014-03-24 12:05:55 · 398 阅读 · 0 评论 -
poj 2000 Gold Coins
Gold CoinsTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 16229Accepted: 10172DescriptionThe king pays his loyal knight in gold coins. Onthe first day of his service, the原创 2014-03-24 12:05:57 · 483 阅读 · 0 评论 -
hdu 2034 人见人爱A-B
http://acm.hdu.edu.cn/showproblem.php?pid=2034#include #include #include using namespace std;int main(){ int n,m; int i,j,t; long int a[102],b[102]; while(cin>>n>>m) { if(!n&原创 2014-03-24 12:06:04 · 450 阅读 · 0 评论 -
foj1001 使用了位图
Problem 1001 Duplicate PairAccept:3561 Submit:16898Time Limit: 1000mSec MemoryLimit : 65536 KB 1001 使用了位图,需要将数组初始化为0值" TITLE="foj 1001 使用了位图,需要将数组初始化为0值" /> ProblemDescriptionA原创 2014-03-24 12:06:08 · 599 阅读 · 0 评论 -
foj1050 Number lengths
1050 Number lengths" TITLE="foj 1050 Number lengths" /> Problem 1050 Number lengthsAccept:858 Submit:1819Time Limit: 1000mSec MemoryLimit : 32768 KB 1050 Number lengths" TITLE="foj原创 2014-03-24 12:06:10 · 465 阅读 · 0 评论 -
foj 2027
http://acm.fzu.edu.cn/problem.php?pid=2027#include#include#includeusing namespace std;int main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); charstr[105];原创 2014-03-24 12:06:17 · 398 阅读 · 0 评论 -
世界末日
★实验任务看完电影《2012》 ,小c 相信 2012年12 月21 日将会是世界末日,于是他每天都在计算离世界末日还有几天。但是他觉得计算太麻烦了,希望让你写一个程序帮帮他。你需要编写一个日期类,实现计算当前日期距离 2012 年 12 月 21 日还有几天的功能。★数据输入数据采用标准输入输出。输入的日期格式为“YYYY-MM-DD”(数据保证该日期合法,并且在2012年12原创 2014-03-24 12:06:14 · 573 阅读 · 0 评论 -
蛇形填数
示例:#includeconst int MAX=10;int a[MAX][MAX];using namespace std;int main(){int n,x,y,tot=0; while(scanf("%d",&n),n{memset(a,0,sizeof(a));tot=a[x=0][y=0]=1;while(tot{while(y+1<n&&!原创 2014-03-24 12:04:10 · 429 阅读 · 0 评论 -
CodeForces 110A Nearly Lucky N…
CodeForces110ANearly LuckyNumberTime Limit: 2000MSMemory Limit: 262144K64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status] DescriptionPetya loves lucky numbers. Weall原创 2014-03-24 12:05:59 · 673 阅读 · 0 评论