自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Day-1

1、人们出于不同的原因参加大学(例如,新的经历、职业准备、增加的知识)。你认为人们为什么上大学?用具体的理由和例子来支持你的答案。People attend college or university for many different reasons.(For example ,new expreriences ,career perpareation,) why do you thi...

2018-07-31 21:25:38 274

原创 N - Find a way HDU - (双起点bfs)

N - Find a way HDU - 2612 #include<bits/stdc++.h>using namespace std;#define inf 0x3f3f3f3fconst int maxn=205;char mmp[maxn][maxn];int Time[5][maxn][maxn];bool vis[maxn][maxn];int n,...

2018-07-31 20:15:37 262

原创 M - 非常可乐 HDU - 1495 (kele)

M - 非常可乐 HDU - 1495  #include<bits/stdc++.h>using namespace std;#define inf 0x3f3f3f3fint s,n,m,ans;bool vis[101][101][101];//所有状态得标记。bool flag;void dfs(int x,int y,int z,int step)...

2018-07-31 17:51:50 316

原创 L - Oil Deposits HDU - (简单联通块搜索)

L - Oil Deposits HDU - 1241 #include<bits/stdc++.h>using namespace std;#define maxn 105char mmp[maxn][maxn];int t[8][2]= {{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};int n,...

2018-07-31 14:48:23 150

原创 B - Ohana Cleans Up (个人赛 Round 3)

B - Ohana Cleans Up CodeForces - 554B 错误:自以为擦掉0多的列就ok了。#include<bits/stdc++.h>using namespace std;int colum[105]={0};int main(){ char str[105][105],str1[105][105]; int n,sum;...

2018-07-31 11:15:27 156

原创 A - Kyoya and Photobooks(个人赛 Round 3)

对错一念之间错的:#include<bits/stdc++.h>using namespace std;int tong [30]= {0};int main(){ string str; cin>>str; int ans=str.size(),sum=0; for(int i=0; i<ans; i++) ...

2018-07-31 11:13:15 162

原创 A - 棋盘问题(DFS搜索顺序)

A - 棋盘问题 POJ - 1321 TLE:#include<iostream>#include<vector>#include<cstring>using namespace std;const int maxn=10;char mmp[maxn][maxn];int n,k,ans,sum;vector<pair&l...

2018-07-31 11:05:53 604

原创 E - 圆桌会议 HDU - 1214 (切分两段(典型的逆序n*(n-1)/2)

这种相邻交换的问题注意联想冒泡排序。E - 圆桌会议 HDU - 1214 /**惭愧啊!刚看到这个题的时候没有看懂,又看了几遍还是没看懂,但是一直感觉应该模拟或者暴力搜索,想了很久可依旧没有什么思路,无奈之下就看了大牛们的代码,突然好像明白了,不过有点想吐血的感觉,不扯了,看题:假设在在一条直线上对编号为1-n的n个人进行翻转先假设第n个人不动,第n-1个人到第n个人的右...

2018-07-30 20:23:08 216

原创 C - Big Number HDU - (大数取模string & %)

C - Big Number HDU - 1212 #include<bits/stdc++.h>using namespace std;const int maxn=32768;int a[maxn]= {0};int main(){ int b; string a; while(cin>>a>>b) {...

2018-07-30 19:40:42 195

原创 F - 七夕节 HDU - 1215 (因数分解)

#include<bits/stdc++.h>using namespace std;const int maxn=500005;int a[maxn]= {0};int main(){ int n,t,ans; cin>>t; while(t--) { ans=1; cin>>n; ...

2018-07-30 18:47:23 184

原创 SDUT-合并果子之哈夫曼树(priority_queue)

http://acm.sdut.edu.cn/onlinejudge2/index.php/Home/Contest/contestproblem/cid/2385/pid/2127.html#include<bits/stdc++.h>using namespace std;int a[10000];int main(){ int n,a1,a2,i; ...

2018-07-29 19:38:39 258

原创 C - Talented Chef ZOJ - 3778 (贪心)

C - Talented Chef ZOJ - 3778 #include<bits/stdc++.h>using namespace std;int a[40005];int main(){ int T,n,m,big,sum; cin>>T; while(T--) { sum=big=0; cin>...

2018-07-28 21:27:31 265

原创 L - Access System ZOJ - 3787 (注意函数内赋值引用调用)

L - Access System ZOJ - 3787 #include<bits/stdc++.h>using namespace std;struct node{ int h,m,s,order,flag;} a[20005];bool cmp(node x,node y){ if(x.h==y.h&&x.m==y.m) ...

2018-07-28 21:04:22 176

原创 G - Ternary Calculation (简单计算式优先级)

G - Ternary Calculation #include<bits/stdc++.h>using namespace std;bool cmp(char s1,char s2){ int flag1,flag2; flag1=flag2=0; if(s1=='*'||s1=='/'||s1=='%') flag1=1; ...

2018-07-28 21:02:58 219

原创 Summer Individual - A - Pokemon Master

A - Pokemon Master ZOJ - 3776  #include <iostream>using namespace std;int main(){ int t,n,m,sum2,sum1; int a[10],b[40]; cin>>t; while(t--) { sum1=su...

2018-07-28 19:09:54 198

原创 B - Frogger (青蛙路径-SPFA)

B - Frogger  思路:复制一下别人的题意,有两只青蛙和若干块石头,现在已知这些东西的坐标,两只青蛙A坐标和青蛙B坐标是第一个和第二个坐标,现在A青蛙想要到B青蛙那里去,并且A青蛙可以借助任意石头的跳跃,而从A到B有若干通路,问从A到B的所有通路上的最大边,比如有  有两条通路  1(4)5 (3)2 代表1到5之间的边为4,  5到2之间的边为3,那么该条通路跳跃范围(两...

2018-07-27 20:49:29 1609 4

原创 D - Silver Cow Party POJ - 3268 (dij-图反转)

One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered (方便的编号)1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (单向)...

2018-07-27 09:42:22 283

原创 C - Heavy Transportation ( dijkstra 变形)

C - Heavy Transportation Hugo Heavy is happy. After the breakdown of the Cargolifter project(项目崩盘) he can now expand business(扩大业务)But he needs a clever man who tells him whether there really is...

2018-07-27 08:32:03 429

原创 Til the Cows Come Home (SPFA-vector存储 无需去重)

Til the Cows Come Home POJ - 2387 #include<iostream>#include<vector>#include<cstring>#include<queue>using namespace std;const int maxn=2005;#define inf 0x3f3f3f3fin...

2018-07-26 21:40:52 200

原创 Til the Cows Come Home (最短路矩阵存图去重边)

Til the Cows Come Home POJ - 2387  #include<iostream>#include<cstring>using namespace std;const int maxn=2005;#define inf 0x3f3f3f3fint a[maxn][maxn];int m,n;int dis[maxn];i...

2018-07-26 21:15:09 310

原创 SDUT- 马拉松赛 Round 1(无标记bfs)

C - Ice Cave CodeForces - 540C  #include<bits/stdc++.h>using namespace std;#define maxn 505int n,m;int sx,sy,ex,ey;char mmp[maxn][maxn];int to[4][2]= {{1,0},{0,1},{-1,0},{0,-1}};s...

2018-07-26 19:59:51 202

原创 SDUT-2018-Round 1(A - GukiZ and Contest)

A - GukiZ and Contest CodeForces - 551A  #include <bits/stdc++.h>using namespace std;struct node{ int prize,order1,order2;} a[2005];bool cmp1(node x,node y){ return x.prize...

2018-07-26 19:17:14 183

原创 SDUT-AOE网上的关键路径(SPFA)

http://acm.sdut.edu.cn/onlinejudge2/index.php/Home/Index/problemdetail/pid/2498.htmlSPFA没有用贪心去找出最优的边去优化全部进行松弛一遍 。有点可以检测负环 ;关键是 邻接表打发简单;区别:不再是vis[]标记是否访问过;而是用一个inque数组 来判断是否入队注意反向建图数据...

2018-07-25 20:57:27 292

原创 SDUT-合法拓扑序列(Not unique)

http://acm.sdut.edu.cn/onlinejudge2/index.php/Home/Index/problemdetail/pid/2140.html有向无环图一个无环的有向图称作有向无环图(directed acycline graph),简称DAG图。假设以有向图表示一个工程的施工图或程序的数据流图,则图中不允许出现回路,如果出现回路,说明了某项活动以它自己为先决条件...

2018-07-25 19:14:09 899

原创 G - Sea and Islands CodeForces - 544B (矩阵构造)

G - Sea and Islands#include<iostream>using namespace std;int main(){    int n,k;    cin>>n>>k;    int flag=0;    if(n%2==0)        flag=1;    if(flag)    {        if(n*...

2018-07-21 11:49:33 222

原创 F - Set of Strings CodeForces - 544A (分割string)

F - Set of Strings题目大意:拆分成n个以不同首字母开头的字符串#include<iostream>#include<vector>#include <string>using namespace std;bool vis[35]={0};int main(){ vector<int >q;int n,...

2018-07-21 11:09:53 201

原创 B - School Marks CodeForces - 540B(贪心)

Little Vova studies programming in an elite (精英)school. Vova and his classmates are supposed to write n progress tests, for each test they will get a mark from 1 to p. Vova is very smart and he can wr...

2018-07-21 10:40:30 298

原创 C - Letters(前缀求和,二分查找)

都是二分函数,头文件<algorithm> upper_bound返回第一个大于的元素的下标; lower_bound返回第一个大于等于元素的下标;#include <iostream>#include <algorithm>//必须包含的头文件using namespace std;int main(){ int point[10] = {1,3,7...

2018-07-06 15:31:02 756

原创 SDUT 算法训练赛-B - File Name(string-删除操作)

c++字符串的插入与删除操作整理了一下字符串最最简单基础的几个用法一、字符串的插入字符串的插入用到的是string的insert函数。先从最常用的开始(1)在字符串s1的第pos个位置前 插入字符串s2s1.insert( pos,s2);(2)在字符串s1的第pos个位置前 插入字符串s2的从begin开始到end的前一个字符结束的子串s1.insert(pos,s2,begin,end)(3)...

2018-07-06 14:53:08 160

原创 SDUT 算法训练赛 contest 7(set--去重)

A - Remove Duplicates CodeForces - 978A #include <bits/stdc++.h>using namespace std;set<int>q;int a[500],b[55];int n;int main(){ int m=0; cin>>n; for(int i=1; i<...

2018-07-06 14:29:59 241

原创 C++文件读写

#include<iostream>#include<fstream>using namespace std;int main(){ ofstream out("grade"); if(!out) { cout<<"can not open"<<endl; return 1; }...

2018-07-06 09:35:48 161

原创 C++流操纵符

#include<iostream>using namespace std;int main(){ cout.precision(4); cout.width(10); cout<<10.12345<<endl; cout.fill('*'); cout.width(10); cout<<10.1...

2018-07-06 09:11:10 927

原创 C++异常处理机制

#include<iostream>using namespace std;void testfun(int age){ try { if(age<0) throw"请输入学生年龄必须是整数"; if(age>20) throw age; cout<&...

2018-07-06 08:48:12 176

原创 C++类模板-(stack)<template>

模板每次使用前都得重新声明#include&lt;iostream&gt;using namespace std;template &lt;class T,int n=10&gt;class anystack{ T tstack[n]; int element; int top;public : anystack():element(n),top(0) {...

2018-07-06 08:19:54 218

原创 SDUT 算法训练赛E - Reachability from the Capital (tarjan 缩点)

E - Reachability from the Capital CodeForces - 999E   E - Reachability from the Capital CodeForces - 999E  #include&lt;bits/stdc++.h&gt;using namespace std;#define maxn 5050vector&lt...

2018-07-04 00:03:00 231

原创 SDUT 算法训练赛 (简单字符串操作)

C - Alphabetic Removals CodeForces - 999C #include&lt;bits/stdc++.h&gt;using namespace std;const int maxn=400005;char a[maxn],b[maxn],temp;int main(){ int n,k,m=0; cin&gt;&gt;n&gt;&gt;k&g...

2018-07-03 23:44:50 160

原创 A - Mishka and Contest

A - Mishka and Contest CodeForces - 999A #include&lt;bits/stdc++.h&gt;using namespace std;int n,k,a[110],b[110];int main(){int ans=0; cin&gt;&gt;n&gt;&gt;k; for(int i=0; i&lt;n; i++) ...

2018-07-03 23:43:04 227

原创 SDUT 算法训练赛 B - Reversing Encryption(string-Reverse)

B - Reversing Encryption CodeForces - 999B #include&lt;bits/stdc++.h&gt;using namespace std;int n,k,t[150];char a[110],temp;int main(){ int m=0; cin&gt;&gt;n; for(int i=1; i&lt;=n; i+...

2018-07-03 23:41:07 148

原创 Popular Cows - 2186 (tarjan 缩点)

Popular Cows OpenJ_Bailian - 2186 题目大意是有n头牛,他们有m对特殊的关系关系A B表示A仰慕B 恩 是感觉怪怪的= =然后如果A仰慕B B仰慕C 那么A也仰慕C 也就是关系是可传递的要求找出被其他牛都仰慕的牛的数目一开始很费解,要不是放在强连通里,实在没法往这方向靠……其实反过来想的话比较好像,强连通分支的定义——强连通分支中从任何一个点都可以访问到其余各点(有...

2018-07-03 17:29:11 103

原创 迷宫城堡 HDU - 1269

#include&lt;cstdio&gt;#include&lt;cstdlib&gt;#include&lt;cmath&gt;#include&lt;iostream&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;#include&lt;vector&gt;using namespace std;#define maxn

2018-07-02 21:09:48 146

空空如也

空空如也

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

TA关注的人

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