C题,刚开始以为遍历整个树,后来发现二重循环判断就行了

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f; vector<int>v[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n,m;
cin>>n>>m;
for(int i=;i<m;i++)
{
int a,b;
cin>>a>>b;
v[a].push_back(b);
v[b].push_back(a);
}
for(int i=;i<v[].size();i++)
{
int u=v[][i];
for(int j=;j<v[u].size();j++)
{
if(v[u][j]==n)
{
cout<<"POSSIBLE"<<endl;
return ;
}
}
}
cout<<"IMPOSSIBLE"<<endl;
return ;
}
/******************** ********************/

C

D题,根据数据范围可以看出n必须是50,否则a会大于1e16+1000,先枚举1到50的过程,然后加上去就行了

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f; ll ans[N][N];
int main()
{
ios::sync_with_stdio(false);
cin.tie();
ll k;
cin>>k;
cout<<<<endl;
memset(ans,,sizeof ans);
for(int i=;i<;i++)
{
for(int j=;j<;j++)
{
if(j==i)ans[i][j]=ans[i-][j]+;
else ans[i][j]=ans[i-][j]-;
}
}
ll s=k/,p=k%;
for(int i=;i<;i++)
cout<<ans[p][i]+49ll+s<<(i==?'\n':' ');
return ;
}
/******************** ********************/

D

E题,直接每次把a[i]减到n以下(刚开始以为会超时就没写。。。)

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f; ll a[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie();
ll n,ans=;
cin>>n;
for(int i=;i<n;i++)cin>>a[i];
while(){
ll maxx=-1e17,id;
for(int i=;i<n;i++)
{
if(a[i]>maxx)
{
maxx=a[i];
id=i;
}
}
if(maxx<n)break;
for(int i=;i<n;i++)
{
if(i==id)a[i]%=n;
else a[i]+=maxx/n;
}
ans+=maxx/n;
}
cout<<ans<<endl;
return ;
}
/*********************
10
1000 193 256 777 0 1 1192 1234567891011 48 425
*********************/

E

AtCoder Regular Contest 079的更多相关文章

  1. 【构造】AtCoder Regular Contest 079 F - Namori Grundy

    对每个点的取值都取最小的可能值. 那个图最多一个环,非环的点的取值很容易唯一确定. 对于环上的点v,其最小可能取值要么是mex{c1,c2,...,ck}(ci这些是v直接相连的非环点)(mex是). ...

  2. 【贪心】AtCoder Regular Contest 079 E - Decrease (Judge ver.)

    每次将最大的数减到n以下,如此循环直到符合题意. 复杂度大概是n*n*log?(?). #include<cstdio> #include<iostream> #include ...

  3. 【构造】AtCoder Regular Contest 079 D - Decrease (Contestant ver.)

    从n个t变化到n个t-1,恰好要n步,并且其中每一步的max值都>=t,所以把50个49当成最终局面,从这里开始,根据输入的K计算初始局面即可. #include<cstdio> # ...

  4. Atcoder AtCoder Regular Contest 079 E - Decrease (Judge ver.)

    E - Decrease (Judge ver.) Time limit : 2sec / Memory limit : 256MB Score : 600 points Problem Statem ...

  5. AtCoder Regular Contest 061

    AtCoder Regular Contest 061 C.Many Formulas 题意 给长度不超过\(10\)且由\(0\)到\(9\)数字组成的串S. 可以在两数字间放\(+\)号. 求所有 ...

  6. AtCoder Regular Contest 094 (ARC094) CDE题解

    原文链接http://www.cnblogs.com/zhouzhendong/p/8735114.html $AtCoder\ Regular\ Contest\ 094(ARC094)\ CDE$ ...

  7. AtCoder Regular Contest 092

    AtCoder Regular Contest 092 C - 2D Plane 2N Points 题意: 二维平面上给了\(2N\)个点,其中\(N\)个是\(A\)类点,\(N\)个是\(B\) ...

  8. AtCoder Regular Contest 093

    AtCoder Regular Contest 093 C - Traveling Plan 题意: 给定n个点,求出删去i号点时,按顺序从起点到一号点走到n号点最后回到起点所走的路程是多少. \(n ...

  9. AtCoder Regular Contest 094

    AtCoder Regular Contest 094 C - Same Integers 题意: 给定\(a,b,c\)三个数,可以进行两个操作:1.把一个数+2:2.把任意两个数+1.求最少需要几 ...

随机推荐

  1. WCF引用 代码

    方法1: using (ChannelFactory<ICommonService> channelFactory = new ChannelFactory<ICommonServi ...

  2. django-Query Ajax 实例 ($.ajax、$.post、$.get)

    Jquery在异步提交方面封装的很好,直接用AJAX非常麻烦,Jquery大大简化了我们的操作,不用考虑浏览器的诧异了. 推荐一篇不错的jQuery Ajax 实例文章,忘记了可以去看看,地址为:ht ...

  3. python中unicode和str的组合

    python中unicode对象和str对象拼接在一起,会自动将str对象转换成unicode对象 即:a="aa" b=u"bb" c=a+b type(c) ...

  4. beego——模板语法

    一.基本语法 go统一使用{{和}}作为左右标签,没有其它的标签符号. 使用"."来访问当前位置的上下文,使用"$"来引用当前模板根级的上下文,使用$var来访 ...

  5. java 获取request参数集

    request里有两个方法 request.getParameterMap(); request.getParameterNames(); 我想用这两种方法获取. 1.用request.getPara ...

  6. 微信小程序学习笔记(2)--------框架之目录结构

    框架提供了自己的视图层描述语言 wxml 和 WXSS,以及基于 JavaScript 的逻辑层框架,并在视图层与逻辑层间提供了数据传输和事件系统. 一.响应的数据绑定 框架的核心是一个响应的数据绑定 ...

  7. URAL 2078 Bowling game

    题目: Bowling game In all asocial teams members ignore each other uniformly, each tight-knit team buil ...

  8. nodejs多核处理

    前言大家都知道nodejs是一个单进程单线程的服务器引擎,不管有多么的强大硬件,只能利用到单个CPU进行计算.所以,有人开发了第三方的cluster,让node可以利用多核CPU实现并行. 随着nod ...

  9. $python正则表达式系列(4)——分组和后向引用

    分组,即分组匹配,也称为捕获组,是正则中的一种比较重要的匹配方式.此外后向引用和分组相结合,可以写出很多复杂匹配场景的正则. 1. 分组 分组的方法:将子表达式用小括号括起来,如:(exp),表示匹配 ...

  10. get app id

    Install Download the Web AppBuilder for ArcGIS (Developer Edition) ZIP file to your local drive and ...