昨天才回学校 刚好赶上CF所以就没写博客 不过还是水题了……

A.

比赛的时候被hack了 仔细读题才知道grey也算是黑白的

英语不好好伤心……

 #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<queue>
#define M(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
int main(){
int n,m;
char cl;
bool ok=true;
scanf("%d%d",&n,&m);
getchar();
for(int i=;i<n;i++){
while(true){
scanf("%c",&cl);
if(cl=='\n') break;
if(cl==' ') continue;
if(cl!='W'&&cl!='B'&&cl!='G') ok=false;
}
}
if(ok) puts("#Black&White");
else puts("#Color");
return ;
}
/* 2 2
C M
Y Y 3 2
W W
W W
B B 1 1
W */

B.

一开始看样例能看出来一点题意……

题意呢……

有两种店 问两种店之间的最短距离

遍历一遍就好了……

 #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<queue>
#define M(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
bool bk[];
struct bian{
int start,over,val;
}v[];
int main(){
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
for(int i=;i<m;i++)
scanf("%d%d%d",&v[i].start,&v[i].over,&v[i].val);
for(int i=;i<k;i++){
int a;
scanf("%d",&a);
bk[a]=true;
}
int min_=;
for(int i=;i<m;i++)
if(bk[v[i].start]^bk[v[i].over])
if(v[i].val<min_) min_=v[i].val;
if(min_!=) printf("%d\n",min_);
else printf("-1\n");
return ;
}
/* 5 4 2
1 2 5
1 2 3
2 3 4
1 4 10
1 5 3 1 1
1 2 3
3 */

C.

公式题 给一个数n 问n是不是勾股数 是的话输出另外两个

公式也是上网才搜到……

n==1和n==2时没有勾股数 其他数都有

n是偶数的时候三个数分别是2*n,n*n+1,n*n-1

n是奇数的时候是2*n,2*n*n+2*n,2*n*n+2*n+1

看了下别人的代码 构造很巧妙……

 #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<queue>
#define M(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
int main(){
ll n;
scanf("%I64d",&n);
if(n==||n==) printf("-1\n");
else if(n%&&(n/=)) printf("%I64d %I64d\n",*n*n+*n,*n*n+*n+);
else if(n/=)printf("%I64d %I64d\n",n*n-,n*n+);
return ;
}
/* 3 6 1 17 67 */

[ An Ac a Day ^_^ ] Codeforces Round #368 Div. 2 A B C的更多相关文章

  1. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  2. Codeforces Round #368 (Div. 2) C. Pythagorean Triples(数学)

    Pythagorean Triples 题目链接: http://codeforces.com/contest/707/problem/C Description Katya studies in a ...

  3. Codeforces Round #368 (Div. 2) B. Bakery (模拟)

    Bakery 题目链接: http://codeforces.com/contest/707/problem/B Description Masha wants to open her own bak ...

  4. Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)

    Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...

  5. Codeforces Round #368 (Div. 2) C

    Description Katya studies in a fifth grade. Recently her class studied right triangles and the Pytha ...

  6. Codeforces Round #368 (Div. 2) B

    Description Masha wants to open her own bakery and bake muffins in one of the n cities numbered from ...

  7. Codeforces Round #368 (Div. 2) A

    Description Small, but very brave, mouse Brain was not accepted to summer school of young villains. ...

  8. Codeforces Round #368 (Div. 2)A B C 水 图 数学

    A. Brain's Photos time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  9. Codeforces Round #368 (Div. 2) D. Persistent Bookcase

    Persistent Bookcase Problem Description: Recently in school Alina has learned what are the persisten ...

随机推荐

  1. iOS正则表达

    问题引入 1.要验证用户输入的密码长度是否满足6~18位的长度 ^.{6,18}$ 2.固定电话都是0区号-八位数字的格式,那么正则表达式的匹配如下 ^0\\d{2}\-?\\d{8}$ 3.对于密码 ...

  2. 浅谈javascript中stopImmediatePropagation函数和stopPropagation函数的区别

    在事件处理程序中,每个事件处理程序中间都会有一个event对象,而这个event对象有两个方法,一个是stopPropagation方法,一个是stopImmediatePropagation方法,两 ...

  3. 改造jQuery-Tagit 插件支持中文全角的逗号和空格

    jQuery 的 tagit 插件效果还是不错的,今天用到该插件但发现不能自定义标签分隔符,只能是英文半角逗号或空格,于是想改造下 效果: 先研究了一番插件的代码,发现并不能通过插件自身的扩展方法来实 ...

  4. 洞穴勘测(bzoj 2049)

    Description 辉辉热衷于洞穴勘测.某天,他按照地图来到了一片被标记为JSZX的洞穴群地区.经过初步勘测,辉辉发现这片区域由n个洞穴(分别编号为1到n)以及若干通道组成,并且每条通道连接了恰好 ...

  5. 如何使用Git上传代码到GitHub

    1.在Github上面创建Github仓库: 2.下载Github Shell到本地:https://desktop.github.com/ 3.打开Github Shell,输入以下命令生成秘钥来验 ...

  6. wpf xmal基础

    1.名称空间的引用 比如想使用System.Windows.Controls名称空间 首先需要把改名称空间所在的程序集presentationFramework.dll引用到项目里 然后在根元素的起始 ...

  7. Egret 学习之 从HelloWorld项目开始 (二)

    1,创建新项目HelloWorld ,可以在界面上点击文件->新建,也可以在命令行使用create: 2,src 目录,存放我们的代码.我们编写的代码都放在src目录下面. bin-debug ...

  8. Hibernate 注解说明

      转:http://blog.csdn.net/u012312373/article/details/46566081   1.类级别注解 @Entity     映射实体类 @Table    映 ...

  9. Linux中的shell函数编写

    function huge_cp() { while read line1; do cp $line1 ../; done; } function huge_rm() { while read lin ...

  10. 使用HttpWebRequest方式访问外部接口

    第一步,如果不是http网站,则需认证信托证书 /// <summary> /// 认证信托证书 /// </summary> /// <param name=" ...