【CodeForces】【#285】Div.2
生平第一场Codeforce……纪念一下,虽然跪的跟渣渣似的……啊不就是跪成渣渣了……
A、B暴力过去的……不知道会不会超时……C我犯了个2B错误,让输出总共多少条边,我都求出来边集E了……直接输出E.size()就行了……我居然还特么的自己用n去算!还找度数为0的点去减!WA了两次pretest……然后时间上浪费也好多……本来可以上2000分的T_T果然还是经验不足啊。
A:
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;++i)
#define F(i,j,n) for(int i=j;i<=n;++i)
#define D(i,j,n) for(int i=j;i>=n;--i)
using namespace std; int main(){
// freopen("input.txt","r",stdin);
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
int val1=max(a*/,a-a*c/),val2=max(b*/,b-b*d/);
if (val1>val2) printf("Misha\n");
else if (val1<val2) printf("Vasya\n");
else printf("Tie\n");
return ;
}
B:
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;++i)
#define F(i,j,n) for(int i=j;i<=n;++i)
#define D(i,j,n) for(int i=j;i>=n;--i)
using namespace std; int cnt=,num[]; string oldname[],newname[];
bool sign[]; int main(){
ios::sync_with_stdio(false);
// freopen("input.txt","r",stdin);
int n;
cin >> n;
string s1,s2; int temp=; F(i,,n){
temp=;
cin >> s1 >> s2;
F(j,,cnt) if (s1==newname[j]) {temp=j; break;}
if (temp) newname[temp]=s2;
else {oldname[++cnt]=s1; newname[cnt]=s2;}
}
cout <<cnt<<endl;
F(i,,cnt)
cout << oldname[i]<<" "<<newname[i]<<endl;
return ;
}
C:
#include<cstdio>
#include<queue>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;++i)
#define F(i,j,n) for(int i=j;i<=n;++i)
#define D(i,j,n) for(int i=j;i>=n;--i)
#define pb push_back
using namespace std;
const int N=; void read(int &v){
v=; int sig=;
char ch=getchar();
while(ch<''||ch>''){ if (ch=='-') sig=-; ch=getchar();}
while(ch>=''&&ch<=''){ v=v*+ch-''; ch=getchar();}
} int degree[N],sum[N],a[N],b[N];
queue<int>Q;
struct edge{int from,to;};
vector<edge>E; int main(){
// freopen("input.txt","r",stdin);
int n;
scanf("%d",&n);
F(i,,n-)
scanf("%d%d",°ree[i],&sum[i]);
int ans=;
F(i,,n-)
if (degree[i]==) Q.push(i); while(!Q.empty()){
int x=Q.front(); Q.pop();
if (degree[x]<) continue;
degree[x]=; E.pb((edge){x,sum[x]});
degree[sum[x]]--;
sum[sum[x]]^=x;
if (degree[sum[x]]==) Q.push(sum[x]);
}
printf("%d\n",E.size());
rep(i,E.size())
printf("%d %d\n",E[i].from,E[i].to);
return ;
}
D:(Orz vfleaking)
伏特跳蚤国王() ::
a * ! + b * ! + c * ! + ...
a < , b < , c < ... 伏特跳蚤国王() ::
把大家表示成这个样子 = =|| 伏特跳蚤国王() ::
= =|||| 大家。。。就是。。所有数。。 伏特跳蚤国王() ::
比如读进来的排列。。。把它的名次写成这个形式。。 伏特跳蚤国王() ::
然后在这个形式下做加法。。 Tunix() ::
!然后按找逐位递增的进制来进位? Tunix() ::
只保留后n位……? 伏特跳蚤国王() ::
嗯 = = 伏特跳蚤国王() ::
你既然都写成这个形式了。。加到 ?? * n! 这一位的时候 伏特跳蚤国王() ::
就可以溜了
VFK的讲解
【CodeForces】【#285】Div.2的更多相关文章
- 【Codeforces #312 div2 A】Lala Land and Apple Trees
# [Codeforces #312 div2 A]Lala Land and Apple Trees 首先,此题的大意是在一条坐标轴上,有\(n\)个点,每个点的权值为\(a_{i}\),第一次从原 ...
- 【Codeforces AIM Tech Round 4 (Div. 2) C】
·将排序限制于子序列中,又可以说明什么呢? C. Sorting by Subsequences ·英文题,述大意: 输入一个长度为n的无重复元素的序列{a1,a2……an}(1<= ...
- 【Codeforces Round #438 C】 Qualification Rounds
[链接]h在这里写链接 [题意] 给你n个问题,每个人都知道一些问题. 然后让你选择一些问题,使得每个人知道的问题的数量,不超过这些问题的数量的一半. [题解] 想法题. 只要有两个问题. 这两个问题 ...
- 【Codeforces Round #438 B】Race Against Time
[链接]h在这里写链接 [题意] 时针.分钟.秒针走不过去. 问你从t1时刻能不能走到t2时刻 [题解] 看看时针.分钟.秒针的影响就好. 看看是不是在整时的位置就好. 然后看看影响到x不能到y; 然 ...
- 【Codeforces Round #438 A】Bark to Unlock
[链接]h在这里写链接 [题意] 在这里写题意 [题解] 枚举它是在连接处,还是就是整个字符串就好. [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc+ ...
- 【codeforces 718 C&D】C. Sasha and Array&D. Andrew and Chemistry
C. Sasha and Array 题目大意&题目链接: http://codeforces.com/problemset/problem/718/C 长度为n的正整数数列,有m次操作,$o ...
- 【Codeforces 321E / BZOJ 5311】【DP凸优化】【单调队列】贞鱼
目录 题意: 输入格式 输出格式 思路: DP凸优化的部分 单调队列转移的部分 坑点 代码 题意: 有n条超级大佬贞鱼站成一行,现在你需要使用恰好k辆车把它们全都运走.要求每辆车上的贞鱼在序列中都是连 ...
- 【codeforces contest 1119 F】Niyaz and Small Degrees
题目 描述 \(n\) 个点的树,每条边有一个边权: 对于一个 \(X\) ,求删去一些边后使得每个点的度数 \(d_i\) 均不超过 \(X\) 的最小代价: 你需要依次输出 \(X=0 \to n ...
- 【Codeforces】Round #491 (Div. 2) 总结
[Codeforces]Round #491 (Div. 2) 总结 这次尴尬了,D题fst,E没有做出来.... 不过还好,rating只掉了30,总体来说比较不稳,下次加油 A:If at fir ...
- 【Codeforces】Round #488 (Div. 2) 总结
[Codeforces]Round #488 (Div. 2) 总结 比较僵硬的一场,还是手速不够,但是作为正式成为竞赛生的第一场比赛还是比较圆满的,起码没有FST,A掉ABCD,总排82,怒涨rat ...
随机推荐
- canvas 绘制矩形和圆形
canvas绘制有两神方法:1).填充(fill)填充是将图形内部填满. 2).绘制边框 (stroke)绘制边框是不把图形内部填满,只是绘制图形的外框. 当我们在绘制图形的时候,首先要设定好绘制的样 ...
- JSON,JSONP
http://blog.csdn.net/huaishuming/article/details/40046729 说明: 在做2个系统间传值时出现: 已阻止交叉源请求:同源策略不允许读取 http: ...
- 学习c的第8天
#include <stdio.h> int main() { char ch; printf("请输入分数等级(A,B,C,D):"); scanf("%c ...
- SymPy库常用函数
简介 SymPy是一个符号计算的Python库.它的目标是成为一个全功能的计算机代数系统,同时保持代码简 洁.易于理解和扩展.它完全由Python写成,不依赖于外部库.SymPy支持符号计算.高精度计 ...
- pure的bug记录2
<select id="stacked-state" style=" font-family: "Microsoft YaHei"; " ...
- 关于iphone消息推送把C#当服务器端来发送
看了苹果消息推送文档,感觉推送很简单的,但是还是按个人习惯把这些简单知识记录下来,在需要时候再查看一下! 在开发之前,要准备以下的资料 1.证书(包括产生证书和调试证书) 2.证书密码 3.唯一标识( ...
- sqlalchemy - day2
Relationship Configuration 一.one to many 直接上代码 from sqlalchemy import create_engine engine = create ...
- C/C++走过的坑(基础问题篇)
1.有符号int与无符号int比较 #define TOTOL_ELEMENTS (sizeof(a) / sizeof(a[0]) ); int main() { int a[] = {23,24, ...
- 快速同步mysql数据到redis中
MYSQL快速同步数据到Redis 举例场景:存储游戏玩家的任务数据,游戏服务器启动时将mysql中玩家的数据同步到redis中. 从MySQL中将数据导入到Redis的Hash结构中.当然,最直接的 ...
- Java入门到精通——基础篇之static关键字
一.概述 static 关键字是声明静态变量,静态方法用的.static的含义是属于类且不属于类对象的变量和函数. 二.static的产生. 在创建对象的时候除非用new ...