2017年3月19日
摘要:
The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ag 阅读全文
posted @ 2017-03-19 04:47
奚政
阅读(161)
推荐(0)
摘要:
小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。 所以现在Gardon想让小希来解决一个更 阅读全文
posted @ 2017-03-19 04:43
奚政
阅读(195)
推荐(0)
摘要:
矩形面积并 线段树-扫描线裸题 1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 #include<math.h> 5 using namespace std; 6 const int maxm=2e3+5; 7 con 阅读全文
posted @ 2017-03-19 04:39
奚政
阅读(175)
推荐(0)
摘要:
You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found 阅读全文
posted @ 2017-03-19 04:37
奚政
阅读(774)
推荐(0)
摘要:
给出修建边的边权,求连通所有点的最小花费 最小生成树裸题 1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 6 struct seg{ 7 int a,b,l; 8 bool 阅读全文
posted @ 2017-03-19 04:34
奚政
阅读(142)
推荐(0)
摘要:
数列的单点修改、区间求和 树状数组或线段树入门题 1 #include<stdio.h> 2 #include<string.h> 3 4 int c[50005],N; 5 6 void add(int x,int a){ 7 while(x<=N){ 8 c[x]+=a; 9 x+=(x&-x) 阅读全文
posted @ 2017-03-19 04:30
奚政
阅读(173)
推荐(0)
摘要:
hdu1097 求a^b的末位数 打表O(1) 1 import java.util.*; 2 3 public class Main { 4 static int [][]a = new int[15][15]; 5 static int []num = new int[15]; 6 public 阅读全文
posted @ 2017-03-19 04:26
奚政
阅读(198)
推荐(0)
摘要:
hdu1029 找出数列中出现(N+1)/2次的数,暴力模拟 1 #include<stdio.h> 2 #include<map> 3 using namespace std; 4 5 int main(){ 6 int n; 7 while(scanf("%d",&n)!=EOF){ 8 map 阅读全文
posted @ 2017-03-19 04:22
奚政
阅读(225)
推荐(0)
摘要:
hdu2099 模拟 1 #include<stdio.h> 2 int m[100]; 3 int main(){ 4 long long a,b,t; 5 while(scanf("%I64d%I64d",&a,&b)!=EOF&&(a!=0&&b!=0)){ 6 t=a*100; 7 long 阅读全文
posted @ 2017-03-19 04:18
奚政
阅读(195)
推荐(0)
摘要:
将一个偶数拆成两个素数的和,欧拉筛暴力 1 #include<stdio.h> 2 #include<string.h> 3 #define N 10001 4 int prime[10001]; 5 bool check[10001]; 6 int n,i,ans,tot=0,j; 7 8 voi 阅读全文
posted @ 2017-03-19 04:17
奚政
阅读(192)
推荐(0)
摘要:
hdu2090 模拟 1 #include<stdio.h> 2 int main(){ 3 char b[100]; 4 double price=0,a1,a2; 5 int i=0; 6 while(scanf("%s%lf%lf",b,&a1,&a2)!=EOF){ 7 price+=a1* 阅读全文
posted @ 2017-03-19 04:16
奚政
阅读(273)
推荐(0)
摘要:
数字中不能出现4或者连续的62,数位DP裸题 1 #include<stdio.h> 2 #include<string.h> 3 long long ans; 4 bool a[1000000]; 5 void fun(){ 6 for(long long i=0;i<=1000000;i++){ 阅读全文
posted @ 2017-03-19 04:08
奚政
阅读(200)
推荐(0)
摘要:
hdu2088 1 #include<stdio.h> 2 #include<algorithm> 3 using namespace std; 4 int h[55]; 5 int main(){ 6 int N,t=0; 7 while(scanf("%d",&N)!=EOF&&N!=0){ 8 阅读全文
posted @ 2017-03-19 04:06
奚政
阅读(271)
推荐(0)
摘要:
在字符串中不可重叠地寻找子串数量,暴力/KMP 1 #include<stdio.h> 2 #include<string.h> 3 4 int main(){ 5 char a[1005],b[1005]; 6 while(scanf("%s",a)!=EOF&&a[0]!='#'){ 7 sca 阅读全文
posted @ 2017-03-19 04:05
奚政
阅读(390)
推荐(0)
摘要:
hdu2085 模拟 1 #include<stdio.h> 2 long long a[35][2]; 3 void fun(){ 4 a[0][0]=1; 5 a[0][1]=0; 6 for(int i=1;i<=33;i++){ 7 a[i][0]=3*a[i-1][0]+2*a[i-1][ 阅读全文
posted @ 2017-03-19 04:03
奚政
阅读(189)
推荐(0)
摘要:
数字三角形,DP裸题 1 #include<stdio.h> 2 #include<string.h> 3 #define max(a,b) (a)>(b)?a:b 4 5 int g[101][101],dp[101][101]; 6 7 int max1(int i,int j){ 8 retu 阅读全文
posted @ 2017-03-19 04:01
奚政
阅读(114)
推荐(0)
摘要:
给出数轴n个坐标,求一个点到所有点距离总和最小。排序后最中间一个点或两个点之间就是最优 1 #include<stdio.h> 2 #include<algorithm> 3 using namespace std; 4 int x[502]; 5 6 int main(){ 7 int M; 8 阅读全文
posted @ 2017-03-19 03:59
奚政
阅读(306)
推荐(0)
摘要:
给出不同字母的权值,计算有多少种字母组合权值小于50,母函数裸题 1 #include<stdio.h> 2 #include<string.h> 3 4 long long c1[51],c2[51]; 5 6 int main(){ 7 int N; 8 while(scanf("%d",&N) 阅读全文
posted @ 2017-03-19 03:56
奚政
阅读(117)
推荐(0)
摘要:
hdu2080 计算两点关于原点夹角,数学 1 #include<stdio.h> 2 #include<math.h> 3 double len(double x1,double y1,double x2,double y2){ 4 return sqrt((x1-x2)*(x1-x2)+(y1- 阅读全文
posted @ 2017-03-19 03:54
奚政
阅读(192)
推荐(0)
摘要:
计算数的和的种类,母函数裸题 1 #include<stdio.h> 2 #include<string.h> 3 int c1[1000],c2[1000],a,b; 4 5 int main(){ 6 int T; 7 while(scanf("%d",&T)!=EOF){ 8 int n,k; 阅读全文
posted @ 2017-03-19 03:51
奚政
阅读(166)
推荐(0)
摘要:
hdu2073 数学 1 #include<stdio.h> 2 #include<math.h> 3 double len(double x){ 4 return sqrt(x*x+(x+1)*(x+1)); 5 } 6 7 int main(){ 8 int N; 9 while(scanf(" 阅读全文
posted @ 2017-03-19 03:48
奚政
阅读(385)
推荐(0)
摘要:
字典树裸题 1 #include<stdio.h> 2 #include<string.h> 3 int next[5000][26]; 4 bool is_e[5000]; 5 int cnt; 6 int ans; 7 8 void Insert(char *word,int s1){ 9 in 阅读全文
posted @ 2017-03-19 03:42
奚政
阅读(1012)
推荐(0)
摘要:
hdu2069 选取硬币组成定值,暴力 1 #include<stdio.h> 2 int v[6]={0,50,25,10,5,1}; 3 4 int main(){ 5 int n; 6 while(scanf("%d",&n)!=EOF){ 7 int ans=0,ans1=0; 8 for( 阅读全文
posted @ 2017-03-19 03:39
奚政
阅读(329)
推荐(0)
摘要:
1 #include<stdio.h> 2 long long arr[21]; 3 long long c(int a,int b) 4 { 5 long long i,sum=1,j; 6 for (i=a,j=1;i>=a-b+1,j<=b;i--,j++) sum=sum*i/j; 7 re 阅读全文
posted @ 2017-03-19 03:36
奚政
阅读(176)
推荐(0)
摘要:
棋盘的一角走到另一角并且不越过对角线,卡特兰数,数据量小,可以当做dp求路径数 1 #include<stdio.h> 2 long long a[36][36]; 3 int main() 4 { 5 int n,count=0; 6 while (scanf("%d",&n)!=EOF&&n!= 阅读全文
posted @ 2017-03-19 03:34
奚政
阅读(391)
推荐(0)
摘要:
单源最短路裸题 1 #include<stdio.h> 2 #include<string.h> 3 #define min(a,b) (a)<(b)?a:b 4 #define INF 100001 5 int T,S,D,dist[1050],v[1050][1050],m,l[1050],r[ 阅读全文
posted @ 2017-03-19 03:30
奚政
阅读(204)
推荐(0)
摘要:
关于指数型母函数的题目,通过用公式并展开得到系数做的吧,取最后两位就是对100取模 1 #include<stdio.h> 2 3 int QuickPow(int a,long long n,int p){ 4 int temp=a,ans=1; 5 while(n){ 6 if(n&1)ans= 阅读全文
posted @ 2017-03-19 03:28
奚政
阅读(214)
推荐(0)
摘要:
hdu2064 汉诺塔变形,数学题 1 #include<stdio.h> 2 long long A[36]; 3 int main(){ 4 A[1]=2; 5 int i; 6 for(i=2;i<=35;i++){ 7 A[i]=3*A[i-1]+2; 8 } 9 while(scanf(" 阅读全文
posted @ 2017-03-19 03:25
奚政
阅读(238)
推荐(0)
摘要:
hdu 2060 斯诺克,读懂题意直接模拟 1 #include<stdio.h> 2 3 int main(){ 4 int N; 5 int i,a[21]; 6 a[0]=0; 7 for(i=1;i<=6;i++){ 8 a[i]=(15-i)*i/2; 9 } 10 for(i=7;i<= 阅读全文
posted @ 2017-03-19 03:22
奚政
阅读(309)
推荐(0)
摘要:
N^2的dp,刚入门的时候很难想到,dp[i]表示到达第i个点的最小时间,可以从之前任意一点处加上充电时间充电转移过来。 1 #include<stdio.h> 2 #define min(a,b) (a)<(b)?a:b 3 int L,N,C,T,VR,VT1,VT2,p[102]; 4 dou 阅读全文
posted @ 2017-03-19 03:16
奚政
阅读(143)
推荐(0)
|
|
|