自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 1032-找规律II

(http://acm.xidian.edu.cn/problem.php?id=1032)#include<cstdio> typedef long long ll; const ll mod=10007;ll feima(ll a,ll b) { ll c=1; while(b) { if(b&1) c=c*a%mod;

2016-10-12 19:43:03 419

原创 1031-找规律I

(http://acm.xidian.edu.cn/problem.php?id=1031)#include<stdio.h> #define maxn 1005 int c[maxn][maxn]; int gcd(int a,int b){ return b==0?a:gcd(b,a%b); } int main() { int n,m,ans,tmp; while(s

2016-10-11 22:45:55 399

原创 1111-Too Easy

(http://acm.xidian.edu.cn/problem.php?id=1111) 对于一排n个正方形,有f(n)种方案达成目标,若第n个块是白色,则有f(n-1)种方案,若第n个块是黑色,则第n-1个块必为白色,那么有f(n-2)+n-2种方案。 则f(n)=f(n-1)+f(n-2)+n-2 。 写成矩阵形式: (http://img.blog.csdn.net/

2016-10-11 21:45:14 330

原创 1109-Too Naive

(http://acm.xidian.edu.cn/problem.php?id=1109)#include<cstdio> #include<cstring> const int mod=10007; struct Mat { int mat[3][3]; }; Mat Mult(Mat a,Mat b) { Mat c; memset(c.mat,0,sizeof(c.m

2016-10-11 21:14:29 333

原创 1042-另一个简单游戏

(http://acm.xidian.edu.cn/problem.php?id=1042)#include<bits/stdc++.h> #define maxn 105 using namespace std; int c[maxn]; int main() { int n,T; double ans; scanf("%d",&T); while(T--)

2016-10-10 18:52:53 412

原创 1109-Too Naive

思路:考虑最后一行放置的状态,有三种放置情况 (http://acm.xidian.edu.cn/problem.php?id=1109)#include<stdio.h> #define N 10007 #define maxn 1000005 int dp[maxn]; int main() { dp[1]=1,dp[2]=2,dp[3]=4; for(int i=4;i<ma

2016-10-10 18:28:10 260

原创 1040-简单的游戏

(http://acm.xidian.edu.cn/problem.php?id=1040)#include<bits/stdc++.h> using namespace std; int main() { int a,b,c,n; scanf("%d",&n); int x,y,z; while(n--) { scanf("%d%d%d",&

2016-10-09 23:00:18 254

原创 1011- 数一爱高斯函数

(http://acm.xidian.edu.cn/problem.php?id=1011) 解法一:找规律普通解法TLE#include<stdio.h> int main() { long long n; //freopen("in.txt","r",stdin); while(scanf("%lld",&n)!=EOF){ long long i=1,

2016-10-09 22:17:43 629

原创 int ,long , long long类型的范围

unsigned int 0~4294967295 int 2147483648~2147483647 unsigned long 0~4294967295 long 2147483648~2147483647 long long的最大值:9223372036854775807 long long的最小值:-9223372036854775808

2016-10-09 11:48:10 263

原创 1022-A simple math problem 2

解法一:数论加筛+前缀和 (http://acm.xidian.edu.cn/problem.php?id=1022)//其实题目中f[n]的值可理解为存在多少个整数对使a*b<=n #include<cstdio> #define N 1007 #define maxn 1000005 using namespace std; int f[maxn]; void Procede(int n)

2016-10-09 11:21:03 332

原创 1056-寻找BOSS

只是想单纯写一下搜索 (http://acm.xidian.edu.cn/problem.php?id=1056)#include<cstdio> #include<cstring> #define maxn 1005 using namespace std; int i,j,k,n,ans; int c[maxn][maxn]; int dir[2][2]={{0,1},{1,0}}; bool

2016-10-08 15:41:37 288

原创 1056-寻找BOSS

(http://acm.xidian.edu.cn/problem.php?id=1056) 正确题解AC//dp[i][j]表示从(0,0)到达(i,j)有多少种 //dp[i][j]=dp[i-1][j]+dp[i][j-1] #include<cstdio> #include<cstring> #define maxn 1005 using namespace std; int dp[m

2016-10-08 15:39:41 405

原创 1055-如此遍历

//受CCF中Z字形扫描题目的影响,,,竟然一个一个的输出。其实重新开一个一维(只要一维就行,ZZ的我竟然开二维数组)数组保存遍历结果就行 http://acm.xidian.edu.cn/problem.php?id=1055#include<stdio.h> #include<cstring> int main() { //freopen("orz.txt","w",stdout);

2016-10-07 15:23:12 305

原创 划分数

#include<cstdio> #define N 1001 #define Mod (long long)(1e9+7) using namespace std; long long n,m; long long dp[N][N]; int main() { for(int i=1;i<=1000;i++) dp[i][1]=1; for(int i=1;i<=1

2016-10-07 11:15:27 265

原创 括号匹配

#include<cstdio> using namespace std; int main() { char str[25]; fgets(str,25,stdin); char *p; int top=0,flag=0; char stack[25]; for(p=str;*p&&flag==0;p++) { switch(

2016-10-07 11:09:38 300

原创 5883-The Best Path

(http://acm.split.hdu.edu.cn/showproblem.php?pid=5883)#include<bits/stdc++.h> using namespace std; int indeg[100001]; int a[100001],s[1000001],t[1000001]; int main() { int T; scanf("%d",&T);

2016-10-07 11:08:54 355

原创 算数表达式求值

#include<bits/stdc++.h> #define maxn 30 using namespace std; unsigned char Prior[8][8] = { //运算符优先级表 // '+' '-' '*' '/' '(' ')' '#' '^' {'>','>','<','<','<','>','>','<'}, {'>','>'

2016-10-07 11:07:29 757

转载 贪吃蛇

#include<stdio.h> #include<time.h> #include<windows.h> #include<stdlib.h>#define U 1 #define D 2 #define L 3 #define R 4 //蛇的状态,U:上 ;D:下;L:左 R:右typedef struct SNAKE //蛇身的一个节点 { int x; int y;

2016-10-07 11:05:10 484

原创 线性表

#include<cstdio> #include<cstdlib> #define LIST_INIT_SIZE 100 #define LISTINCREMENT 10 using namespace std; typedef int ElemType; ElemType *pa,*pb,*pc,*pa_last,*pb_last,*p0; typedef struct { ElemT

2016-10-07 10:51:11 265

转载 最长公共子序列

//求取所有的最长公共子序列 #include <iostream> using namespace std; const int X = 100, Y = 100; //串的最大长度 char result[X+1]; //用于保存结果 int count=0; //用于保存公共最长公共子串的个数

2016-10-07 10:50:17 222

原创 一元稀疏多项式相加

#include<cstdio> #include<cstdlib> using namespace std; typedef struct { int ceof; int expn; }Poly; typedef struct Polynode { Poly data; struct Polynode *next; }Polynode,*Polylink; void

2016-10-07 10:49:15 1155

原创 136 - Ugly Numbers

//输出1 2 3 4 5 6 8 9 10 12 15 #include<stdio.h> #include<vector> #include<queue> #include<set> using namespace std; typedef long long LL; const int coeff[3]={2,3,5};int main() { priority_queue<LL,ve

2016-10-07 10:48:14 252

原创 约瑟夫环

#include<cstdio> #include<cstdlib> //#include<bits/stdc++.h> using namespace std; typedef struct Lnode { int id; int code; struct Lnode *next; }Lnode,*Linklist; Linklist Createlist(int n)//

2016-10-07 10:46:53 263

原创 约瑟夫环

#include<bits/stdc++.h> #define maxn 50 using namespace std; bool in[maxn]; //int a[maxn]; queue<int> q; int c[maxn],t[maxn]; int main() { memset(in,0,sizeof(in)); int i,j,k,m,n,code,*p; p

2016-10-07 10:45:43 229

原创 简易通讯录

#include<stdio.h> #include<stdlib.h> #include<string.h> struct DATA { char key[15]; char addr[20]; char telephone[15]; char qq[12]; }; typedef struct Node { DATA data; struct

2016-10-07 10:44:50 249

原创 模式匹配

#include<cstdio> #include<iostream> using namespace std; int i,j,pos,next[20]; void get_next(string T) { i=1,j=0; next[1]=0; while(i<T.length()) { if(j==0||T[i-1]==T[j-1])

2016-10-07 10:42:07 188

原创 C++容器

#include <iostream> #include <cstdio> #include <string> #include <vector> #include <deque> #include <list> #include <map> using namespace std; int main() { int n; cin >> n; map<int, int> f;

2016-10-07 10:41:02 207

原创 Pointer详解

#include <stdlib.h>typedef struct LNode{ int number; int password; struct LNode * next; }LNode, *Linklist;void swap1(int a, int b) { int temp; temp = a; a = b;

2016-10-07 10:39:13 713

原创 getSG

#include<stdio.h> #include<string.h> #include<math.h> #define N 100005 int f[N],sg[N],hash[N]; void getSG(int n) { int i,j; memset(sg,0,sizeof(sg)); for(i=1;i<=n;i++) { me

2016-10-07 10:34:32 689

原创 201509-4-高速公路

(http://115.28.138.223/view.page?gpid=T29)//邻接表存图 #include <stdio.h> #include <string.h> #include <iostream> #define maxn 200010 using namespace std;int dfn[maxn],low[maxn]; int clock,top; //当前元素是被访问

2016-10-07 10:32:37 374

原创 156-Ananagrams

#include<string> #include<iostream> #include<cctype> #include<vector> #include<map> #include<algorithm> using namespace std;map<string,int>cnt; vector<string>words;string repr(const string& s) { st

2016-10-07 10:29:17 209

原创 540-团体队列

//list以链表形式实现,相当于双向链表 #include<iostream> #include<cstdio> #include<cstring> #include<list> #include<string> #include<algorithm> using namespace std;int t,data,post;//data表示入队元素,post表示元素所在队伍编号 int tea

2016-10-07 10:26:26 257

原创 1172-Hiking

(http://acm.xidian.edu.cn/problem.php?id=1172)#include <stdio.h> #include<algorithm> #include<cstring> #define maxn 20000+5 using namespace std;int a,b,T,c[maxn]; int dp[maxn]; int main() {

2016-10-07 10:24:40 174

原创 1172-Hiking

(http://acm.xidian.edu.cn/problem.php?id=1172)#include<stdio.h> #include<algorithm> #define maxn 201 int c[maxn],min; int T,b1=0,b2=0; void dfs(int b1,int b2,int k) { if (k==T) { if(abs

2016-10-07 10:23:26 260

翻译 201412-3-集合竞价

(http://115.28.138.223/view.page?gpid=T19)#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> using namespace std; struct node { string s; double a;

2016-10-07 10:21:11 153

原创 201503-3-节日

(http://115.28.138.223/view.page?gpid=T25)//1850的1月1号是星期二 #include<stdio.h> #include<algorithm> using namespace std; int i,d,g,sum; int m[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,

2016-10-07 10:19:27 275

翻译 201509-3-模板生成系统

(http://115.28.138.223/view.page?gpid=T30)#include<iostream> using namespace std; #include<string.h> #define maxn 0x7fffffff #include<map> #include<stdio.h> int m,n; int main() { int i,j; strin

2016-10-07 10:18:21 380

原创 201412-2-Z字形扫描

(http://115.28.138.223/view.page?gpid=T20)#include<stdio.h> int main() { int i,j,n,x,y; scanf("%d",&n); int c[n][n]; for(i=0;i<n;i++) for(j=0;j<n;j++) scanf("%d"

2016-10-07 10:16:53 279

原创 201512-4-送货

(http://115.28.138.223/view.page?gpid=T34)#include<bits/stdc++.h> /*#include<iostream> #include<vector> #include<algorithm> #include<stack>*/ #define N 10010 using namespace std;vector<int> p[N]; stack

2016-10-07 10:15:25 496 2

原创 201503-4-网络延时

(http://115.28.138.223/view.page?gpid=T24)#include<bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f #define ll long long #define N 200010 #define M 10*Nstruct Edge { int to; int next

2016-10-07 10:09:09 272

空空如也

空空如也

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

TA关注的人

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