- 博客(44)
- 收藏
- 关注
原创 hdu 1874
畅通工程续 #include<bits/stdc++.h> #define MAX 1000000 int maps[202][202]; int M,N; int visited[202],lowcost[202]; void init() { int i,h; int x,y,z; for(i=0;i<N;i++) for(h=0;h<N;h++) maps[i][h]=MAX; for(i=0;i<M;i++) { scanf("%d%d%
2021-08-05 15:17:00
90
原创 hdu 2159
FATE #include<bits/stdc++.h> using namespace std; #define N 110 int dp[N][N],a[N],b[N]; int main() { int n, m, k, s, ans; while(scanf("%d%d%d%d", &n, &m, &k, &s)!=EOF) { memset(dp, 0, sizeof(dp)); for(int i=0; i<k; i++) s
2021-08-04 17:37:08
78
原创 hdu 4508
湫湫系列故事——减肥记I #include <bits/stdc++.h> #define MAXN 100010 using namespace std ; int n ,a[MAXN],b[MAXN],dp[MAXN],m; int main() { while(scanf("%d",&n)==1) { memset(dp,0,sizeof(dp)); for(int i=0;i<n;i++) { scanf("%d %d",&a[i],&
2021-08-04 10:43:12
67
原创 hud 1248
寒冰王座 #include<bits/stdc++.h> using namespace std; int dp[10010]; int n; int main() { int i,j; int a[10]; int T; scanf("%d",&T); while(T--) { a[0]=150,a[1]=200,a[2]=350; memset(dp,0,sizeof dp); scanf
2021-07-28 21:10:32
82
原创 hdu 2191
悼念512汶川大地震遇难同胞——珍惜现在,感恩生活 #include<bits/stdc++.h> using namespace std; #define MAX 1010 struct node{ int p,w; }temp[MAX]; int dp[MAX]; int main() { int t; scanf("%d",&t); while(t--) { memset(dp,0,sizeof dp); int p
2021-07-22 21:38:37
53
原创 hdu 1114
Piggy-Bank #include <bits/stdc++.h> using namespace std; #define MAX 0x3f3f3f3f int main() { int t,n; int p[505],w[505]; int dp[10005]; cin>>t; while (t--) { int e,f,v; scanf("%d %d",&e,&f); v=f-e; scanf("%d",&n);
2021-07-20 21:52:00
66
原创 hud 2602
Bone Collector #include<bits/stdc++.h> using namespace std; #define MAX 1001 int dp[MAX],w[MAX],c[MAX]; int main() { int num,n,v,i,j; scanf("%d",&num); while(num--){ scanf("%d %d",&n,&v); for(i=0;i<n;i++){ scanf("%d",&w[
2021-07-19 21:56:26
65
原创 hdu 1087
Super Jumping! Jumping! Jumping! #include<bits/stdc++.h> using namespace std; #define MAX 1001 int n,dp[MAX],ans; struct node{ int x,y; }a[MAX]; bool cmp(int x,int y){ return a[x].x<a[y].x; } int main(){ int b[MAX],cnt; while(scanf("%d",&n
2021-07-16 11:36:41
59
原创 hdu 1257
最少拦截系统 #include<bits/stdc++.h> using namespace std; #define MAX 30001 int n,high,dp[MAX]; int main(){ while(cin>>n){ memset(dp,0,sizeof dp); for(int i=1;i<=n;i++){ cin>>high; dp[high]++; for(int j=1;j<high;j++){ if
2021-07-14 20:39:14
78
原创 hdu 1160
FatMouse’s Speed #include<bits/stdc++.h> using namespace std; #define MAXN 1010 struct s{ int f; int v; int id; }m[MAXN]; bool cmp(s a,s b){ return a.v>b.v; } int f,v,dp[MAXN],pre[MAXN]; int main() { int count=0,p,len=0; while(scanf("%d %d",
2021-06-03 20:18:39
53
原创 hdu 1950
Bridging signals #include<bits/stdc++.h> using namespace std; #define MAXN 40010 int n,dp[MAXN],d[MAXN]; int main(){ int t,x,len; scanf("%d",&t); while(t--){ scanf("%d",&n); memset(dp,0,sizeof dp); for(int i=1;i<=n;i++){ scanf(
2021-05-31 20:39:48
64
原创 hdu 1421
搬寝室 #include<bits/stdc++.h> using namespace std; #define INF 0x7fffffff //int型最大值 #define MAXN 2020 bool cmp(int a,int b){ return a>b; } int n,k,dp[MAXN][MAXN],a[MAXN]; int main(){ while(scanf("%d %d",&n,&k)!=EOF){ for(int i=1;i<=n;
2021-05-29 17:36:53
59
原创 hdu 1176
免费馅饼 #include<bits/stdc++.h> using namespace std; #define MXX 15 #define MXT 100010 int n,dp[MXT][MXX]; int main() { int T,t,x; while(scanf("%d",&n),n){ T=0; memset(dp,0,sizeof dp); for(int i=1;i<=n;++i){ scanf("%d %d",&x,&
2021-05-24 19:29:33
48
原创 hdu 2048
数塔 #include<bits/stdc++.h> using namespace std; #define ll long long #define MAXN 110 int n,dp[MAXN][MAXN]; int main() { int N; scanf("%d",&N); while(N--){ scanf("%d",&n); for(int i=1;i<=n;++i){ for(int j=1;j<=i;++j){ scan
2021-05-23 20:40:32
83
原创 hdu 4165
Pills #include<bits/stdc++.h> using namespace std; long long f[35]; int main() { int i,n; f[1]=1; f[0]=1; for(i=2;i<=50;i++){ for(int j=0;j<i;j++){ f[i]+=f[j]*f[i-1-j]; } } while(scanf("%d",&n)!=EOF&&n!=0){ printf("
2021-05-19 20:41:18
82
原创 洛谷 p1044
P1044 [NOIP2003 普及组] 栈 #include<bits/stdc++.h> using namespace std; long long f[20]; int main() { int i,n; f[1]=1; f[0]=1; for(i=2;i<=50;i++){ for(int j=0;j<i;j++){ f[i]+=f[j]*f[i-1-j]; } } while(scanf("%d",&n)!=EOF&&
2021-05-16 10:28:10
122
原创 hdu 2067
小兔的棋盘 #include<bits/stdc++.h> using namespace std; long long f[50]; int main() { int i,n; f[0]=1; f[1]=1; for(i=2;i<=50;i++){ for(int j=0;j<=i-1;j++){ f[i]+=f[j]*f[i-1-j]; } } int num=1; while(scanf("%d",&n)!=EOF&&n!
2021-05-15 22:31:14
57
原创 hdu 2045
不容易系列之(3)—— LELE的RPG难题 #include<bits/stdc++.h> using namespace std; long long f[50]; int main() { int i,n; while(scanf("%d",&n)!=EOF){ f[1]=3; f[2]=6; f[3]=6; for(i=4;i<=50;i++){ f[i]=f[i-1]+f[i-2]*2; } printf("%lld\n",f[n]); } re
2021-05-15 21:41:20
57
原创 hdu 2047
阿牛的EOF牛肉串 #include<bits/stdc++.h> using namespace std; long long f[50]; int main() { int i,n; while(scanf("%d",&n)!=EOF){ f[1]=3; f[2]=8; for(i=3;i<=50;i++){ f[i]=f[i-1]*2+f[i-2]*2; } printf("%lld\n",f[n]); } return 0; } ...
2021-05-15 21:06:35
50
原创 hdu 2190
悼念512汶川大地震遇难同胞——重建希望小学 #include<bits/stdc++.h> using namespace std; #define MAXN 40 long long f[MAXN]; int main() { int n,m,i; scanf("%d",&n); f[1]=1; f[2]=3; for(i=3;i<=MAXN;i++) f[i]=f[i-1]+f[i-2]+f[i-2]; for(i=0;i<n;i++
2021-05-13 20:47:50
60
原创 hdu 2050
折线分割平面 #include<bits/stdc++.h> using namespace std; #define MAXN 10001 long long f[MAXN]; int main() { int n,m,i; scanf("%d",&n); f[1]=2; for(i=2;i<=MAXN;i++) f[i]=f[i-1]+4*(i-1)+1; for(i=0;i<n;i++){ scanf("%d",&m); pri
2021-05-13 20:30:41
51
原创 hud 2046
骨牌铺方格 #include<bits/stdc++.h> using namespace std; long long f[51]; int main() { int n; while(scanf("%d",&n)!=EOF){ f[1]=1; f[2]=2; for(int i=3;i<=51;i++) f[i]=f[i-1]+f[i-2]; printf("%lld\n",f[n]); } return 0; }
2021-05-13 19:37:16
48
原创 hdu 2044
一只小蜜蜂… #include<bits/stdc++.h> using namespace std; long long f[50]; int fact(int m){ f[1]=1; f[2]=2; for(int i=3;i<=55;i++) f[i]=f[i-1]+f[i-2]; } int main() { int n,a,b,i,res; scanf("%d",&n); for(i=0;i<n;i++)
2021-05-12 22:00:22
40
原创 hdu 2041
添加链接描述 #include<bits/stdc++.h> using namespace std; int f[50]; int fact(int m){ int i; f[1]=1; f[2]=1; if(m<=2) return 1; else f[m]=f[m-1]+f[m-2]; } int main() { int n,m,i,res; scanf("%d",&n); for(i=0;
2021-05-12 16:27:42
45
原创 hdu 1863
继续畅通工程 #include<bits/stdc++.h> using namespace std; #define MAXN 10010 int m,n,pre[MAXN],ran[MAXN]; struct node{ int a; int b; int c; }s[MAXN]; bool cmp(node a,node b) { return a.c<b.c; } int find(int x) { int t=x; while(x!
2021-05-11 17:22:48
39
原创 hdu 1233
还是畅通工程 #include<bits/stdc++.h> using namespace std; #define MAXN 10010 int m,n,pre[MAXN],ran[MAXN]; struct node{ int a; int b; int c; }s[MAXN]; bool cmp(node a,node b) { return a.c<b.c; } int find(int x) { int t=x; while(x!
2021-05-09 16:48:40
51
原创 hdu 1232
畅通工程 #include<bits/stdc++.h> using namespace std; int bin[1001]; int findx(int x) { int r=x; while(bin[r]!=r) r=bin[r]; return r; } void merge(int a,int b) { int fa,fb; fa=findx(a); fb=findx(b); if(fa!=fb) bin[fa]=fb; } int main() { int n
2021-05-05 20:47:06
38
原创 hdu 2425
Degree Sequence of Graph G #include<bits/stdc++.h> using namespace std; int a[10001]; bool cmp(int x,int y){ return x>y; } int main() { int T,n,tot,ans; scanf("%d",&T); while(T--){ scanf("%d",&n); tot=0; for(int i=1;i<=n;i++){
2021-05-05 15:28:57
43
原创 hdu 3183
A Magic Lamp #include<bits/stdc++.h> using namespace std; int n,vis[1010]; char num[1010]; int main() { while(memset(num,0,sizeof(num)),scanf("%s %d",num,&n)!=EOF){ memset(vis,0,sizeof(vis)); for(int i=1;num[i]!='\0'&&n>0;i++){//从
2021-04-18 10:53:38
38
原创 hdu 1236
排名 #include <bits/stdc++.h> using namespace std; #define MXN 1010 struct sStudent{ char n[25]; int g = 0;} s[MXN]; bool cmp(sStudent a,sStudent b){ if(a.g==b.g){ return strcmp(a.n,b.n)<0; } else return a.g>b.g; }; int main(){ int cnt,
2021-04-15 21:41:20
45
原创 hdu 2037
今年暑假不AC #include<bits/stdc++.h> using namespace std; struct node{ int start; int end; }c[200]; bool cmp(node a,node b){ if(a.end==b.end){ return a.end<b.end; } else return a.start<b.start; } int main() { int n,i; while(scanf("%d",
2021-04-15 18:44:25
37
原创 hdu 1050
Moving Tables #include<bits/stdc++.h> using namespace std; int main () { int T,n,s,t,room[200],i,j,max,k,temp; scanf("%d",&T); while(T--){ for(i=0;i<200;i++){ room[i]=0; } scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d %d",
2021-04-13 22:42:25
38
原创 hdu 1052
Tian Ji – The Horse Racing #include<bits/stdc++.h> using namespace std; #define a 1008 bool cmp(int x,int y){ return x>y; } int main() { int n,t[a],k[a],tmax,tmin,kmax,kmin,ans,i; while(scanf("%d",&n)!=EOF&&n!=0){ for(i=0;i
2021-04-11 10:58:21
56
原创 hdu 1009
FatMouse’ Trade #include <bits/stdc++.h> using namespace std; #define MXN 1001 int m,n; double ans,m2; struct node{ int f,j; double jf; }r[MXN]; bool cmp(node x,node y){ return x.jf>y.jf; } int main() { while(scanf("%d %d",&m,&n)!=EOF)
2021-04-08 21:53:36
34
原创 hdu 1098
Ignatius’s puzzle #include<stdio.h> int main() { int x,a; while(scanf("%d",&x)!=EOF){ for(a=0;a<65;a++){ if((18+a*x)%65==0){ printf("%d\n",a); break; } if(a==64) printf("no\n"); } } return 0; }
2021-04-07 20:34:15
32
原创 hdu 1060
Leftmost Digit #include<stdio.h> #include<math.h> int solve(int n){ double ans; ans=n*log10(n); ans=pow(10,ans-floor(ans)); return ans; } int main() { int n,ans,i,x; while(scanf("%d",&x)!=EOF){ for(i=0;i<x;i++){ scanf("%
2021-04-07 19:22:28
36
原创 hdu 2899
Strange fuction #include<stdio.h> #include<math.h> double f1(double x,double y){ return 6*x*x*x*x*x*x*x+8*x*x*x*x*x*x+7*x*x*x+5*x*x-y*x; } double f2(double x,double y){ return 6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-y*x; } int main() { i
2021-04-01 20:47:43
143
原创 hdu 2199
Can you solve this equation? #include<stdio.h> #define f(x) (x*(x*(x*(x*8+7)+2)+3)+6) double binsearch(double left,double right,double y){ double mid; while(right-left>1e-7){ mid=(left+right)/2; if(f(mid)>y) right=mid-1e-8; else l
2021-03-31 22:15:06
41
原创 hdu 2035
人见人爱A^B #include<stdio.h> int power(int a,int n,int mod) { int ans=1; while(n) { if(n%2==1) ans=ans*a%mod; a=a*a%mod; n=n/2; } return ans; } int main() { int a,n,mod=1000; while(scanf("%d %d",&a,&n)!=EOF) { if(a==0&&
2021-03-30 20:52:44
70
原创 hdu 1097A hard puzzle
hdu 1097 #include<stdio.h> int f[10][10]={{1,0,0},{1,1,1},{1,2,4,8,6,2},{1,3,9,7,1}, {1,4,6,4},{1,5,5},{1,6,6},{1,7,9,3,1},{1,8,4,2,6,8},{1,9,1}}; int c[10]={1,1,4,4,2,1,1,4,4,2}; int s[10]={1,0,1,0,1,1,1,0,1,0}; int main() { int x,y; while(s
2021-03-29 19:55:50
80
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人