自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(56)
  • 收藏
  • 关注

原创 ZOJ 1076

题目长……题目本身是一道很水的LIS题。

2014-08-19 17:26:42 673

原创 ZOJ 1284

水题,暴力就可以过。枚举因数的时候只要枚举2~sqrt(N)就可以了。

2014-08-19 17:03:02 534

原创 ZOJ 1278

水题,直接暴力即可。由于ZOJ无节操地隐去数据范围,苯渣把

2014-08-18 17:39:57 508

原创 ZOJ 1278

直接暴力即可- -由于ZOJ再次无节操地隐去数据范围,我把HASH

2014-08-18 17:36:23 460

原创 ZOJ 1027

这是一道DP题。初看

2014-08-18 16:40:16 651

原创 ZOJ 1025

由于顺序可以改变,所以纯贪心解决。#include "stdio.h"#include "string.h"#include "stdlib.h"struct stick{ int u,v,num;}S[5010],stack[5010];unsigned char vis[5010];int top;int cmp(const void *a,const void *b){

2014-08-18 15:17:30 472

原创 ZOJ 1160 Biorhythms

中国剩余定理。时间:94//Memory Time //256K 94MS #includeusing namespace std;int main(void){ int p,e,i,d; int time=1; while(cin>>p>>e>>i>>d) { if(p==-1 && e==-1 && i==-1 && d==-1) break;

2014-08-17 21:05:04 431

原创 ZOJ 1133 Smith Numbers

Smith数的定义是各位数字之和与它的各个质因数(可以重复)的各位数字之和的总和相同的数,且不是素数。题目本身是一道水题,数据尤其水。下面的代码中加了一个优化:先将所有询问按询问的数字升序排序,处理某个询问A时,如果结果是B,那么对其后询问值小于B的所有询问,都直接给出答案为B。例如:23242526270在处理23时得到58,由于后面四个数都小于5

2014-08-17 20:52:12 824

原创 ZOJ 1113 u Calculate e

纯水题。时间:0毫秒。#include#includeusing namespace std;int main(){ double ans=1, temp=1; int i=0; cout<<"n e"<<endl; cout<<"- -----------"<<endl; cout<<i<<' '<<ans<<endl;

2014-08-17 20:51:15 669

原创 ZOJ 1088 System Overload

典型的Joseph问题……由于数据范围小,直接暴力就可以解决了……用到了链表的数据结构……时间:90毫秒。#include "stdio.h"#include "string.h"struct lianbiao{ int prev,next;}p[152];const int INF=2147483647;void init(int n){ int i; for(i

2014-08-17 20:49:27 483

原创 Codeforces 448D(动态规划、类H数)

这道题可以用类似H数(Humble Number)的方法做。用一个数组f[1..n]记录

2014-07-22 17:02:49 848

原创 Codeforces 448A(简单计算)

水题。#include "stdio.h"#include "math.h"int main(){ int i,a1,a=0,b1,b=0,n,N; for(i=1;i<=3;i++){ scanf("%d",&a1); a+=a1; } for(i=1;i<=3;i++){ scanf("%d",&b1); b+=b1; } scanf("%d",&N);

2014-07-22 16:56:57 649

原创 Codeforces 448B (字符串简单处理,读题)

水题。也要考虑到特殊情况:如t比s长的情况,直接need tree,不用

2014-07-22 16:56:36 718

原创 USACO 2.4.1 The Tamworth Two

模拟即可。无解条件为F

2014-07-21 17:02:56 504

原创 USACO 2.3.2 Cow Pedigrees

标准DP题。DP原理:对某一节点,

2014-07-21 15:55:27 554

原创 USACO 2.3.1 Longest Prefix

基本的动态规划吧。。想到方法了其实很简单(苯渣用暴搜做了2个小时,

2014-07-20 17:32:16 785

原创 USACO 2.3.3 Zero Sum

本题两种解法:一、DFS。二、三进制枚举。

2014-07-20 11:40:50 678

原创 USACO 2.3.4 Money Systems

这道题是整数拆分的变形。

2014-07-20 10:29:34 566

原创 USACO 2.2.4 Party Lamps

交了

2014-07-19 10:32:52 603

原创 USACO 2.2.2 Subset Sums

题意为将1~n分割为和相等的两块。等价为

2014-07-18 15:28:12 534

原创 USACO 2.2.1 Preface Numbering

枚举秒过。/*ID:szwjcch971TASK:prefaceLANG:C++*/#include "stdio.h"#include "string.h"char alphabet[8]="IVXLCDM";int main(){ int i,j,n,k; int total[7]; FILE *fin=fopen("preface.in","r"); FILE *

2014-07-18 14:07:48 717

原创 USACO 2.1.5 Hamming Code

水题。DFS暴搜即可。

2014-07-18 12:51:01 600

原创 USACO 2.1.4 Healthy Hosteins

WA,TLE了九次- -

2014-07-18 10:43:39 470

原创 USACO 2.1.3 Sorting A Three-Valued Sequence

题意大致是说把一个

2014-07-16 16:20:29 643

原创 USACO 2.1.2 Ordered Fractions

先穷举所有分数,然后排序注意题目要求的是最简分数。所以1/2和3/6是一样的,应注意去重。

2014-07-16 15:30:19 594

原创 Codeforces 8A

#include "stdio.h"#include "string.h"char s[100008],s1[107],s2[107];void twist(int n){ int i; char temp; for(i=0;i<=(n-1)/2;i++){ temp=s[i]; s[i]=s[n-1-i]; s[n-1

2014-07-16 11:31:05 634

原创 Codeforces 7A

一、用O(1)的遍历16条行、列,判断是否全黑做,注意盘面全黑时

2014-07-15 21:32:48 456

原创 Codeforces 6A

三角形存在性定理。(说实话题目太绕。。那个degenerate查了半天楞是mei

2014-07-15 21:29:00 396

原创 Codeforces 5A

#include "stdio.h"#include "string.h"int find_char(char s[200],char ch){ int i,len; len=strlen(s); for(i=0;i<=len-1;i++){ if(s[i]==ch)return i; }}int main(){ char s[200],i,bytes=0,c=0; whi

2014-07-15 21:27:17 701

原创 Codeforces 3A Shortest Path of the King

有人说用BFS,但我认为这大可不必。计算从S点到T点需横走多少步,纵走多少bu

2014-07-15 21:26:07 841

原创 Codeforces 2A

#include "stdio.h"#include "string.h"struct person{ char name[40]; int score; int getscore;};int main(){ person a[1020]; int i,j,k,n,p1=0,minget,maxscore,minnum,point,flag=0; char str[40];

2014-07-12 13:42:06 719

原创 HDOJ1029 Ignatius and his princess IV

水题。。类似桶排的思路- -#include #include #include using namespace std;const int maxn=500000;int a[maxn];int main(){ int n; while(scanf("%d",&n)!=EOF) { memset(a,0,sizeof(a));

2014-07-11 13:28:12 462

原创 HDOJ1028 Ignatius and the Princess III

64以前DFS,65以后打表- -#include "stdio.h"int count=0;int ans[56]={2012558,2323520,2679689,3087735,3554345,4087968,4697205,5392783,6185689,7089500,8118264,9289091,10619863,12132164,13848650,15796476,180

2014-07-11 13:27:03 501

原创 HDOJ1027 Ignatius and the Princess II

这道题有多种做法。数学编码、康托展开、STL库等。

2014-07-11 11:20:07 801

原创 HDOJ1027

#include "stdio.h"int main(){ unsigned char is_used[1002]; int n,m,i,j,Count,c; int jiecheng[12]={1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800}; while(scanf("%d%d",&n,&m)!=EOF){ for(i=1

2014-07-11 11:11:04 571

原创 HDOJ1021 Fibonacci again

水题。。#include "stdio.h"int main(){ unsigned char f[1000009]; int k,i; f[1]=1; f[2]=2; for(i=3;i<=1000000;i++)f[i]=(f[i-1]+f[i-2])%3; while(scanf("%d",&k)!=EOF){ if(!f[k+1])printf("yes\n");el

2014-07-09 14:12:49 536

原创 HDOJ1020 Encoding

水题。。简单模拟就可以了。

2014-07-09 13:55:42 468

原创 HDOJ1019 Least Common Multiple

大体思路是先求出1,2个数的LCM2,再求LCM2和第3个数的LCM=L

2014-07-09 13:38:33 452

原创 HDOJ1018 Big Numbers

不得不说,数据太水。。968MSxian xian

2014-07-09 13:21:26 564

原创 HDOJ1017 A Mathematical Curiosity

此题表述过于隐晦。。话说出题人的语文(英语)是体育老师教的?- -

2014-07-09 13:07:42 589

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除