吐槽一下,这次的CF好简单啊。 可是我为什么这么粗心这么大意这么弱。把心沉下来,想想你到底想做什么!

A

题意:O(-1)

思路:O(-1)

 #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std; int main()
{
string s[];
int mp[][];
int n, m;
while(cin >> n >> m)
{
memset(mp,,sizeof(mp));
for(int i=; i<n; i++)
cin >> s[i];
for(int i=; i<n; i++)
{
int cnt=;
for(int j=; j<m; j++)
if(s[i][j]!='S') cnt++;
if(cnt==m)
{
for(int j=; j<m; j++) mp[i][j]=;
}
}
for(int i=; i<m; i++)
{
int cnt=;
for(int j=; j<n; j++)
if(s[j][i]!='S') cnt++;
if(cnt==n)
{
for(int j=; j<n; j++) mp[j][i]=;
}
}
int sum=;
for(int i=; i<n; i++)
for(int j=; j<m; j++)
if(mp[i][j]) sum++;
cout << sum <<endl;
}
}

B

题意:有n个城市,然后给定m对城市不可建路,一个城市到另一个城市最多经过两条路,问你如何建路。

思路:两个城市之间的距离最多为2说明一条线上最多三个点,且有一点必须再所有三个点的中心。找出一个没有在不可连接的城市的点(因为0<M<N/2).

 #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std; const int maxn=;
int que[*maxn]; int main()
{
int n, m;
while(cin >> n >> m)
{
map<int,int>mp;
int num=;
for(int i=; i<m; i++)
{
int u, v;
cin >>u >> v;
mp[u]=;
mp[v]=;
}
int tp;
for(int i=; i<=n; i++)
if(!mp[i]) tp=i;
cout << n- <<endl;
for(int i=; i<=n; i++)
{
if(i!=tp) cout << i << " " << tp <<endl;
}
}
return ;
}

C

题意:O(-1)

思路:开始想复杂了,想成n皇后问题。其实这题想想也就很水的一题,对每行分析,每行能找出一个空点就是可行解,如果有一行找不到,就对每列找,每列能找到一个空点就是可行解。很水的一题,开始写成了N皇后问题,然后再源代码上改的,最后挂了,悲剧,为什么就懒这一些重新写两个for循环不就好了么,下次不能偷懒了。

 #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std; const int maxn=;
int a[maxn][maxn], b[maxn]
string s[]; int main()
{
int n;
while(cin >> n)
{
for(int i=; i<n; i++) cin >> s[i];
int top=, flag=;
for(int i=; i<n; i++)
for(int j=; j<n; j++)
if(s[i][j]=='.')
{
top++;
break;
}
if(top==n)
{
flag=;
for(int i=; i<n; i++)
for(int j=; j<n; j++)
if(s[i][j]=='.')
{
cout << i+ << " " << j+ <<endl;
break;
}
}
top=;
for(int j=; j<n; j++)
for(int i=; i<n; i++)
if(s[i][j]=='.')
{
top++;
break;
}
if(top==n&&!flag)
{
flag=;
for(int j=; j<n; j++)
for(int i=; i<n; i++)
if(s[i][j]=='.')
{
cout << i+ << " " << j+ <<endl;
break;
}
}
if(!flag) puts("-1");
}
return ;
}
/*
3
EEE
...
...
*/

D:

题意:屌丝从起点S出发去终点E找女神,途中可能会遇见情敌,问屌丝最少能遇见几个情敌。

思路:开始看错了题,以为题目要求最少要遇见一个情敌,然后用了两次广搜,起点和终点分别搜一次。题目木有这么要求啊啊啊啊啊啊啊 O.O O.O O.O。

下次能再给我大意一点么!这题不用想得太复杂,不管这么走,屌丝和情敌都往女神那里走,情敌先到女神那里就一定能遇见屌丝然后干一架,从终点广搜一次就够了。

 #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std; const int maxn=;
char map[][];
long long a[maxn][maxn],visit[maxn][maxn];
int n, m, si, sj, di, dj;
int dir[][]= {,,,-,,,-,}; struct node
{
int x, y;
long long time;
} f[maxn*maxn]; void bfs(int st, int sd)
{
queue<node>q;
memset(visit,,sizeof(visit));
node s, p;
s.x=st, s.y=sd, s.time=;
q.push(s);
while(!q.empty())
{
p=q.front();
q.pop();
for(int i=; i<; i++)
{
s.x=p.x+dir[i][];
s.y=p.y+dir[i][];
s.time=p.time+;
if(<=s.x&&s.x<=n&&<=s.y&&s.y<=m&&map[s.x][s.y]!='T'&&!visit[s.x][s.y])
{
visit[s.x][s.y]=;
a[s.x][s.y]=s.time;
q.push(s);
}
}
}
} int main()
{
while(cin >> n >> m)
{
int num=;
for(int i=; i<=n; i++)
{
scanf("%s",map[i]+);
for(int j=; j<=m; j++)
{
if(map[i][j]=='S') si=i, sj=j;
else if(map[i][j]=='E') di=i, dj=j;
else if(''<map[i][j]&&map[i][j]<='')
{
f[num].x=i;
f[num].y=j;
num++;
}
}
}
memset(a,,sizeof(a));
bfs(di,dj);
long long sum=;
for(int i=; i<num; i++)
{
int x=f[i].x, y=f[i].y;
if(a[x][y]<=a[si][sj]&&a[x][y]) sum+=map[x][y]-'';
}
cout << sum <<endl;
}
return ;
}

E:

不会。

Codeforces Round #192 (Div. 2)的更多相关文章

  1. Codeforces Round #192 (Div. 1) C. Graph Reconstruction 随机化

    C. Graph Reconstruction Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/3 ...

  2. Codeforces Round #192 (Div. 1) B. Biridian Forest 暴力bfs

    B. Biridian Forest Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/pr ...

  3. Codeforces Round #192 (Div. 1) A. Purification 贪心

    A. Purification Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/probl ...

  4. [Codeforces Round #192 (Div. 2)] D. Biridian Forest

    D. Biridian Forest time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. Codeforces Round #192 (Div. 2) (330B) B.Road Construction

    题意: 要在N个城市之间修建道路,使得任意两个城市都可以到达,而且不超过两条路,还有,有些城市之间是不能修建道路的. 思路: 要将N个城市全部相连,刚开始以为是最小生成树的问题,其实就是一道简单的题目 ...

  6. Codeforces Round #192 (Div. 2) (330A) A. Cakeminator

    题意: 如果某一行没有草莓,就可以吃掉这一行,某一列没有也可以吃点这一列,求最多会被吃掉多少块蛋糕. //cf 192 div2 #include <stdio.h> #include & ...

  7. Codeforces Round #192 (Div. 2) A. Cakeminator

    #include <iostream> #include <vector> using namespace std; int main(){ int r,c; cin > ...

  8. Codeforces Round #192 (Div. 2) B. Road Construction

    #include <iostream> #include <vector> using namespace std; int main(){ int n,m; cin > ...

  9. Codeforces Round #192 (Div. 2) (329A)C.Purification

    题意: 在一个正常的点可以净化该行该列的所有细胞,判断是否可以净化所有的细胞,并且输出所选的点. 思路: 如果可以的话,一定会选n个点. 先判断每一行是否有正常细胞,然后判断每一列是否有,如果都没有肯 ...

随机推荐

  1. 【设计模式】MVC模式

    MVC 模式代表 Model-View-Controller(模型-视图-控制器) 模式.这种模式用于应用程序的分层开发. Model(模型) - 模型代表一个存取数据的对象或 JAVA POJO.它 ...

  2. 【hibernate criteria】hibernate中criteria的完整用法 转

    ---恢复内容开始--- 转自:http://www.360doc.com/content/090313/10/26262_2794855.html 1.Criteria Hibernate 设计了 ...

  3. hdu 5306 优先队列

    用到优先队列 #include<iostream> #include<string> #include<algorithm> #include<cstdio& ...

  4. mongodb学习03 操作详解

    插入文档 db.test.insert({"name":"jinks"}); 批量插入 db.test.insert([{}, {}, {}]); 一次批量插入 ...

  5. Something about "if"

    分支:If引导了一个分支,语法结构有{if:if, else if,else:if,else:等}if可以单独使用,不一定非要加else,但是为了语句的严谨或者程序的稳定,请尽量使用else(注意if ...

  6. BFS(双向) HDOJ 3085 Nightmare Ⅱ

    题目传送门 题意:一个人去救女朋友,两个人都在运动,还有鬼在"扩散",问最少几秒救到女朋友 分析:开两个队列来表示两个人走过的路,一个人走到的地方另一个人已经vis了,那么就是相遇 ...

  7. Js提示框

    百度搜索 1.artDialog 2.ymPrompt 以下网站提供资料参考 http://www.17sucai.com/ http://www.juheweb.com/ http://www.5i ...

  8. Cache的使用

    公共方法Add 将指定项添加到 Cache 对象,该对象具有依赖项.过期和优先级策略以及一个委托(可用于在从 Cache 移除插入项时通知应用程序). Equals(从 Object 继承) 已重载. ...

  9. ural 1072. Routing

    1072. Routing Time limit: 1.0 secondMemory limit: 64 MB There is a TCP/IP net of several computers. ...

  10. Java NIO非阻塞理论学习

    Java NIO和阻塞IO的区别: 阻塞I/O在调用InputStream.read()方法时是阻塞的,它会一直等到数据到来时(或超时)才会返回:同样,在调用ServerSocket.accept() ...