昨天才回学校 刚好赶上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. HTTP请求返回状态详解

    当用户试图通过 HTTP 访问一台正在运行 Internet 信息服务 (IIS) 的服务器上的内容时,IIS 返回一个表示该请求的状态的数字代码.状态代码可以指明具体请求是否已成功,还可以揭示请求失 ...

  2. ASP.NET中重复表格列合并的实现方法(转自脚本之家)

    这几天做一个项目有用到表格显示数据的地方,客户要求重复的数据列需要合并,就总结了一下.NET控件GridView 和 Repeater 关于重复数据合并的方法. 这是合并之前的效果: 合并之后的效果图 ...

  3. java.lang.IllegalArgumentException: View not attached to window manager

    公司项目线上bug: java.lang.IllegalArgumentException: View not attached to window manager at android.view.W ...

  4. apache bench(ab)压力测试模拟POSt请求

    ab命令格式: -N|--count 总请求数,缺省 : 5w -C|--clients 并发数, 缺省 : 100 -R|--rounds 测试次数, 缺省 : 10 次 -S|-sleeptime ...

  5. angular学习笔记

    1.forEach      arr:参数是key,index json:与jquery相反,参数是value,key2.str-->json    JSON.parse()       ang ...

  6. [UWP小白日记-2]SQLite数据库DOME

    数据库说简单点就是增删改查,但是对新手来说也是要爆肝的.作为一个新手爆肝无数次啊, 血的教训啊现在UWP的教程又少,说多了都是泪.留下来免得以后又爆肝.还有:一定要写注释!一定要写注释!一定要写注释! ...

  7. JS---控制键盘事件

    键盘事件汇总: 1.onkeydown 键盘按下时触发; 2.onkeyup  键盘按下后抬起触发的事件  3.onkeypress 这个事件在用户按下并放开任何字母数字键时发生(不常用) keyCo ...

  8. mybatis(1)

    一.MyBatis简介 MyBatis 是支持普通 SQL 查询,存储过程和高级映射的优秀持久层框架.MyBatis 消除了几乎所有的 JDBC 代码和参数的手工设置以及结果集的检索.MyBatis ...

  9. Django之模型管理器filter处理问题

    今天上班第一天,恭祝所有朋友新年快乐!! 最近在github上发现一个还不错的基于Django的开源博客项目,不过也许是版本原因,其中代码存在着些许问题,今天主要记录下其中的模型处理方法的部分. 这段 ...

  10. java 的对象拷贝(有深浅拷贝两种方式,深拷贝实现的两种方式(逐层实现cloneable接口,序列化的方式来实现))

    Java提高篇--对象克隆(复制)(转自:http://www.cnblogs.com/Qian123/p/5710533.html#_label0)   阅读目录 为什么要克隆? 如何实现克隆 浅克 ...