The 2018 ACM-ICPC Asia Qingdao Regional Contest(青岛网络赛)
A Live Love
水
#include <algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + ; int main()
{
int t;
scanf("%d", &t);
while(t--)
{
int n,m;
scanf("%d%d",&n,&m);
if(m==){
printf("0 0\n");
continue;
}
if(n==m){
printf("%d %d\n",n,m);
continue;
}
if(n>=*m-){
printf("%d %d\n",m,);
continue;
}
for(int i=;i<=m;i++) {
if (n - m >= (m / i + (m % i != )) - ) {
printf("%d %d\n", m, i);
break;
}
}
}
return ;
}
B Red Black Tree
留坑
C Halting Problem
题意:自定义了一些程序,然后问程序会不会崩溃,也就是会不会有死循环出现
思路:队友写的,大致就是同一步不可以运行一摸一样的两次吧
#include <algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + ;
struct com{
char cm[];
int v,k;
}prog[];
bool vstd[][];
int main()
{
int n,t;
scanf("%d", &t);
while(t--) {
scanf("%d",&n);
for(int i=;i<=n;i++){
scanf("%s%d",prog[i].cm,&prog[i].v);
if(prog[i].cm[]!='a'){
scanf("%d",&prog[i].k);
}
}
int r=,ins=;
int flag=;
memset(vstd,,sizeof(vstd));
while(true){
if(ins>n){
break;
}
if(vstd[r][ins]){
flag=;
break;
}
switch(prog[ins].cm[]){
case 'd'://+
vstd[r][ins]=;
r+=prog[ins].v;
r%=;
ins++;
break; case 'e'://==
vstd[r][ins]=;
if(r==prog[ins].v){
ins=prog[ins].k;
}else{
ins++;
}
break; case 'n'://!=
vstd[r][ins]=;
if(r!=prog[ins].v){
ins=prog[ins].k;
}else{
ins++;
}
break; case 'l'://<
vstd[r][ins]=;
if(r<prog[ins].v){
ins=prog[ins].k;
}else{
ins++;
}
break; case 'g'://>
vstd[r][ins]=;
if(r>prog[ins].v){
ins=prog[ins].k;
}else{
ins++;
}
break; default:
vstd[r][ins]=;
ins++;
break;
}
}
if(flag){
puts("Yes");
}else{
puts("No");
}
}
return ;
}
D Pixel Art
留坑
E Infinite Parenthesis Sequence
留坑
F Chaleur
留坑
G Couleur
留坑
H Traveling on the Axis
题意:模拟红绿灯,1过,0停,每一秒之后都会改变所有的灯的状态,1变0,0变1
思路:只需要特判第一步走的需不需要停就可以,之后走起来之后的状态都是重复进行的
#include <algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
char rd[];
ll len;
int main()
{
int n,t;
while(~scanf("%d",&t)) { while (t--) {
scanf("%s", rd);
len = strlen(rd);
long long ans = ;
long long tmp;
for (ll i = ; i < len - ; i++) {
tmp = (len - i - ) * (i + );
if (rd[i] == rd[i + ])tmp *= ;
ans += tmp;
}
//ll b=0;
for (ll i = ; i < len; i++) {
ans += rd[i] == '' ? (len - i) : (len - i) * ;
//b+=rd[i]=='1'?(len-i):(len-i)*2;
} cout << ans << endl;
}
}
return ;
}
I Kuririn MIRACLE
J Press the Button
题意:按灯,当灯亮的时候按压可以加分,每一次按都会重置灯的熄灭时间。
思路:可以先找到两个数的最小公倍数,然后就可以按照这个周期进行一些剪枝,在每一次周期或者是最后一次的剩余时间里可以模拟,队友用了栈写之后超时了,后来另一位队友没有用栈就AC了
#include <algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y)
{
return x % y == ? y : gcd(y, x % y);
} int main()
{
int t;
while(~scanf("%d",&t)) {
while (t--) {
ll a,b,c,d,v,t;
scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&v,&t);
ll time=;
ll tt=a*c/gcd(a,c);
ll ta=a,tc=c;
ll tans=;
while(ta<=tt || tc<=tt){
if(ta<=tc){
tans+=b;
if(ta-time>v){
tans--;
}
time=ta;
ta+=a;
}else if(ta>tc){
tans+=d;
if(tc-time>v){
tans--;
}
time=tc;
tc+=c;
}
}
ll sans=;ta=a,tc=c;
time=;
ll res=t%tt;
while(ta<=res|| tc<=res){
if(ta<=tc){
sans+=b;
if(ta-time>v){
sans--;
}
time=ta;
ta+=a;
}else if(ta>tc){
sans+=d;
if(tc-time>v){
sans--;
}
time=tc;
tc+=c;
}
}sans+=b+d-;
cout<<tans*(t/tt)+sans<<endl;
}
}
return ;
}
K XOR Clique
题意:找一个最大的集合,使得这些任意两个异或后的值都比最小的那个小
思路:有个队友说可以用字典树,后来我想了想好像只需要计算每一个2,4,8,16,32,64,128,256,512,1024......这些区间的数字的个数就可以了,因为不同的这些2的次方它们异或之后显然最高位会是1,使得它们肯定会比最小的那个大,所以肯定是在同一个集合里面的,同一个集合里面的它们的第一位是相同的,所以异或之后肯定会比最小的那个数要小,所以统计区间个数就可以了,先打个表记录一下2的次方。
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<map>
#include<ctime>
using namespace std;
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + ; int main()
{
ll a[];
int sum[];
for(ll i=;i<=;i++)
{
a[i]=(ll)pow(*1.0,i);
// cout<<a[i]<<" ";
}
int t;
while(~scanf("%d",&t))
{
while(t--)
{
int n;
scanf("%d",&n);
memset(sum,,sizeof sum);
for(int i=;i<n;i++)
{
int x;
scanf("%d",&x);
for(int num=;num<=;num++)
{
if(x<a[num])
{
sum[num]++;
break;
}else
continue;
}
}
int maxx=-;
for(int i=;i<=;i++)
maxx=max(maxx,sum[i]);
printf("%d\n",maxx);
}
}
}
The 2018 ACM-ICPC Asia Qingdao Regional Contest(青岛网络赛)的更多相关文章
- The 2018 ACM-ICPC Asia Qingdao Regional Contest
The 2018 ACM-ICPC Asia Qingdao Regional Contest 青岛总体来说只会3题 C #include<bits/stdc++.h> using nam ...
- The 2018 ACM-ICPC Asia Qingdao Regional Contest(部分题解)
摘要: 本文是The 2018 ACM-ICPC Asia Qingdao Regional Contest(青岛现场赛)的部分解题报告,给出了出题率较高的几道题的题解,希望熟悉区域赛的题型,进而对其 ...
- ACM ICPC Central Europe Regional Contest 2013 Jagiellonian University Kraków
ACM ICPC Central Europe Regional Contest 2013 Jagiellonian University Kraków Problem A: Rubik’s Rect ...
- 2019-2020 ICPC, Asia Jakarta Regional Contest (Online Mirror, ICPC Rules, Teams Preferred)
2019-2020 ICPC, Asia Jakarta Regional Contest (Online Mirror, ICPC Rules, Teams Preferred) easy: ACE ...
- The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online J - Press the Button(思维)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4056 题意 有一个按钮.一个灯.一个计时器和一个计数器,每按一次按钮,计时 ...
- The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online -C:Halting Problem(模拟)
C Halting Problem In computability theory, the halting problem is the problem of determining, from a ...
- The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online Solution
A Live Love 水. #include<bits/stdc++.h> using namespace std; typedef long long ll; ; const i ...
- 2018-2019, ICPC, Asia Yokohama Regional Contest 2018 K
传送门:https://codeforces.com/gym/102082/attachments 题解: 代码: /** * ┏┓ ┏┓ * ┏┛┗━━━━━━━┛┗━━━┓ * ┃ ┃ * ┃ ━ ...
- ZOJ - 4048 Red Black Tree (LCA+贪心) The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online
题意:一棵树上有m个红色结点,树的边有权值.q次查询,每次给出k个点,每次查询有且只有一次机会将n个点中任意一个点染红,令k个点中距离红色祖先距离最大的那个点的距离最小化.q次查询相互独立. 分析:数 ...
- 2018 ICPC Asia Jakarta Regional Contest
题目传送门 题号 A B C D E F G H I J K L 状态 Ο . . Ο . . Ø Ø Ø Ø . Ο Ο:当场 Ø:已补 . : 待补 A. Edit Distance Thin ...
随机推荐
- SpringMVC04 很杂很重要(注解,乱码处理,通配符,域属性调用,校正参数名称,访问路径,请求、响应携带参数,请求方法)
1.导入架包 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3 ...
- swift 2特性记录
swift 团队一直在优化,让大家准备在秋天的时候,迁移到swift2做准备. 一.错误处理 异常处理,不是NSError对象和双指针. 可以使用 throws 来指定方法来抛出一个错误. 调用d ...
- Java开发工具IntelliJ IDEA本地历史记录的使用方法
IntelliJ IDEA的本地历史记录可以帮助用户记录并跟踪本地项目的更改,防止项目的意外丢失或来源于IDE之外的项目更改.本教程将展示如何使用本地历史记录查看和恢复某些项目更改. 1 .从头开始创 ...
- Android使用文件管理器打开指定文件夹,浏览里面的内容
Android下可以打开一些文件,带有.doc 等后缀的文件网上一般都有解释,这个写一个使用文件管理器打开指定文件夹的 private void openAssignFolder(String pat ...
- Qt的各种使用技巧
一.基本界面介绍 二.查看帮助的方法 ① 如上图所示,点击右侧帮助菜单查看帮助 ② 双击想要查看的代码,点F1,也会弹出帮助栏 三.修改文本编辑器颜色 长时间使用白底黑字的编辑器经常会使眼睛不舒服,以 ...
- 杭电acm刷题顺序
最近兴趣来了,闲暇之余,回顾大学期间刷过的杭电acm那些入门级别的题,以此巩固基础知识! 以下参考刷题顺序,避免入坑 原文传送门:https://blog.csdn.net/liuqiyao_01/a ...
- js实现排序去重计算字符次数
/*去重*/ var arr=[1,4,4,7,3,9,0,3,2,1,"你好","你","你好","你 "]; var ...
- 如何在SAP Cloud for Customer自定义BO中创建访问控制
文章作者: Yi 已获得Yi的转载许可. 访问控制方式和使用注意事项 1. C4C中的访问控制有两种方式 RelevantForAccessControl AccessControlContext 2 ...
- js 中的 Math.ceil() Math.floor Math.round()
alert(Math.ceil(25.9)); alert(Math.ceil(25.5)); alert(Math.ceil(25.1)); alert(Math.round(25.9)); ale ...
- NYOJ-596-谁是最好的Coder
原题链接 谁是最好的Coder 时间限制:1000 ms | 内存限制:65535 KB 难度:0 描述 计科班有很多Coder,帅帅想知道自己是不是综合实力最强的coder. 帅帅喜欢帅,所以他 ...