Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2)
Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) |
---|
#include <bits/stdc++.h> using namespace std; int n,m,k; ; int main() { cin>>n>>m>>k; ;i<=k-;++i) { sum+=(n+(m-))*-(i)*; } cout<<sum<<endl; }
A - Golden Plate
一个三维数组确定一条路径,直接搜就行
#include<bits/stdc++.h> #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #include<queue> #include<vector> #include<map> #define lson i<<1 #define rson i<<1|1 #define LS l,mid,lson #define RS mid+1,r,rson #define mem(a,x) memset(a,x,sizeof(a)) #define gcd(a,b) __gcd(a,b) #define ll long long #define ull unsigned long long #define lowbit(x) (x&-x) #define pb(x) push_back(x) #define enld endl #define mian main #define itn int #define prinft printf #pragma GCC optimize(2) //#pragma comment(linker, "/STACK:102400000,102400000") const double PI = acos (-1.0); const int INF = 0x3f3f3f3f; ; ; ; ; using namespace std; int n,cnt,temp; int a[MAXN],b[MAXN],ans[MAXN]; //int a,b; ][][]; void init() { mem(t,-); t[][][]=,t[][][]=; t[][][]=,t[][][]=; t[][][]=,t[][][]=; t[][][]=,t[][][]=; t[][][]=,t[][][]=; t[][][]=,t[][][]=; t[][][]=,t[][][]=; t[][][]=,t[][][]=; t[][][]=,t[][][]=; t[][][]=,t[][][]=; } int main() { std::ios::sync_with_stdio(false); cin.tie(NULL); init(); while(cin>>n) { mem(ans,-); ; i<=n-; ++i) { cin>>a[i]; } ; i<=n-; ++i) { cin>>b[i]; } ; i<=; ++i) { temp=i; cnt=; ans[++cnt]=temp; ; j<=n-; ++j) { //cerr<<'#'<<a[j]<<' '<<b[j]<<' '<<temp<<' '<<t[a[j]][b[j]][temp]<<endl; ) { temp=t[a[j]][b[j]][temp]; ans[++cnt]=temp; } else { cnt=; break; } } if(cnt==n) break; } if(cnt==n) { cout<<"YES"<<endl; ; i<=n; ++i) { ) cout<<' '; cout<<ans[i]; } cout<<endl; } else cout<<"NO"<<endl; } ; }
B - Curiosity Has No Limits
二分+贪心(只要n在a+b的范围内,所有的数都可以放进去)
#include<bits/stdc++.h> #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #include<queue> #include<vector> #include<map> #define lson i<<1 #define rson i<<1|1 #define LS l,mid,lson #define RS mid+1,r,rson #define mem(a,x) memset(a,x,sizeof(a)) #define gcd(a,b) __gcd(a,b) #define ll long long #define ull unsigned long long #define lowbit(x) (x&-x) #define pb(x) push_back(x) #define enld endl #define mian main #define itn int #define prinft printf #pragma GCC optimize(2) //#pragma comment(linker, "/STACK:102400000,102400000") const double PI = acos (-1.0); const int INF = 0x3f3f3f3f; ; ; ; ; using namespace std; ll a,b,n,m; bool check(ll m) { )/>(a+b)) return true; else return false; } ll ans1[MAXN],ans2[MAXN]; int main() { //std::ios::sync_with_stdio(false); //cin.tie(NULL); while(cin>>a>>b) { ll l=-,r=*sqrt(a+b); ; i<=; ++i) { m=(l+r)/; if(check(m)) r=m-; else n=m,l=m+; } cerr<<n<<endl; ll cnt1=,cnt2=; ; i--) { if(i<=a) { ans1[++cnt1]=i; a-=i; } else { ans2[++cnt2]=i; b-=i; } } cout<<cnt1<<endl; ; i<=cnt1; ++i) { ) cout<<' '; cout<<ans1[i]; } cout<<endl<<cnt2<<endl; ; i<=cnt2; ++i) { ) cout<<' '; cout<<ans2[i]; } cout<<endl; } ; }
C - Cram Time
Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2)的更多相关文章
- Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) D. Minimum path
http://codeforces.com/contest/1072/problem/D bfs 走1步的最佳状态 -> 走2步的最佳状态 -> …… #include <bits/ ...
- Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) D. Minimum path(字典序)
https://codeforces.com/contest/1072/problem/D 题意 给你一个n*n充满小写字母的矩阵,你可以更改任意k个格子的字符,然后输出字典序最小的从[1,1]到[n ...
- Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2)D(思维,DP,字符串)
#include<bits/stdc++.h>using namespace std;char c[2007][2007];char ans[4007];int s[2007][2007] ...
- (AB)Codeforces Round #528 (Div. 2, based on Technocup 2019 Elimination Round
A. Right-Left Cipher time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #528 (Div. 2, based on Technocup 2019 Elimination Round 4) C. Connect Three 【模拟】
传送门:http://codeforces.com/contest/1087/problem/C C. Connect Three time limit per test 1 second memor ...
- Codeforces Round #512 (Div. 2, based on Technocup 2019 Elimination Round 1) C. Vasya and Golden Ticket 【。。。】
任意门:http://codeforces.com/contest/1058/problem/C C. Vasya and Golden Ticket time limit per test 1 se ...
- Codeforces Round #512 (Div. 2, based on Technocup 2019 Elimination Round 1) E. Vasya and Good Sequences(DP)
题目链接:http://codeforces.com/contest/1058/problem/E 题意:给出 n 个数,对于一个选定的区间,区间内的数可以通过重新排列二进制数的位置得到一个新的数,问 ...
- Codeforces Round #522 (Div. 2, based on Technocup 2019 Elimination Round 3)B. Personalized Cup
题意:把一长串字符串 排成矩形形式 使得行最小 同时每行不能相差大于等于两个字符 每行也不能大于20个字符 思路: 因为使得行最小 直接行从小到大枚举即可 每行不能相差大于等于两个字符相当于 ...
- Codeforces Round #522 (Div. 2, based on Technocup 2019 Elimination Round 3) C. Playing Piano
题意:给出一个数列 a1 a2......an 让你构造一个序列(该序列取值(1-5)) 如果a(i+1)>a(i) b(i+1)>b(i) 如果a(i+1)<a(i) 那么b( ...
随机推荐
- bzoj千题计划209:bzoj1185: [HNOI2007]最小矩形覆盖
http://www.lydsy.com/JudgeOnline/problem.php?id=1185 题解去看它 http://www.cnblogs.com/TheRoadToTheGold/p ...
- Codeforces Round #481 (Div. 3) G. Petya's Exams
http://codeforces.com/contest/978/problem/G 感冒是真的受不了...敲代码都没力气... 题目大意: 期末复习周,一共持续n天,有m场考试 每场考试有如下信息 ...
- Spring 学习02
一.上节内容回顾 1 spring的概念 (1)核心:ioc和aop (2)spring一站式框架 2 spring的bean管理(xml) (1)bean实例化 (2)注入属性 (3)注入对象属性 ...
- 基于JWT(Json Web Token)的ASP.NET Web API授权方式
token应用流程 初次登录:用户初次登录,输入用户名密码 密码验证:服务器从数据库取出用户名和密码进行验证 生成JWT:服务器端验证通过,根据从数据库返回的信息,以及预设规则,生成JWT 返还JWT ...
- [整理]IIS 6.0 下部署 Asp.net MVC Web Api 后 HTTP PUT and DELETE 请求失败
http://guodong.me/?p=1560 ASP.NET MVC 4 has a new feature called WebAPI which makes it much easier t ...
- 使用渐进式JPEG来提升用户体验
今天才认识到原来JPEG文件有两种保存方式他们分别是Baseline JPEG(标准型)和Progressive JPEG(渐进式).两种格式有相同尺寸以及图像数据,他们的扩展名也是相同的,唯一的区别 ...
- 【转】详解linux vi命令用法
功能最强在的编辑器--vi vi是所有UNIX系统都会提供的屏幕编辑器,它提供了一个视窗设备,通过它可以编辑文件.当然,对UNIX系统略有所知的人, 或多或少都觉得vi超级难用,但vi是最基本的编辑器 ...
- c++刷题(33/100)笔试题1
笔试总共2小时,三道题,时间挺充裕的,但是最后只做了一道,原因在于自己很浮躁,不审题,不仔细思考.没过的两道都是稍微改一下代码就能过,但是没过就是没过,要引以为戒 题目1: 小W有一个电子时钟用于显示 ...
- 关于sru源码class Model的parameters
class Model(nn.Module): def __init__(self, words, args): super(Model, self).__init__() self.args = a ...
- Redis常见操作命令
1.库相关 select 索引 => 选择库 dbsize => 查询当前库中Key的数量 flushdb => 清空当前库 flushall => 清空所有库(建议不要用,除 ...