A题 A Live Love 原题链接:https://pintia.cn/problem-sets/1036903825309761536/problems/1041155943483625472


#include<bits/stdc++.h>
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<algorithm>
#include<stack>
using namespace std;
#define inf 0x3f3f3f3f
typedef long long ll; int main()
{
#ifndef ONLINE_JUDGE
//freopen("in.txt","r",stdin);
#endif // ONLINE_JUDGE
int t;int n,m;int ans1,ans2;
scanf("%d",&t);
while(t--)
{
cin>>n>>m;
n=n-m;
ans2=m;
if(m==0)
ans1=0;
else if(m<=n)
ans1=1;
else ans1=ceil(m*1.0/(n+1));
cout<<ans2<<" "<<ans1<<endl;
}
return 0; }

C题 Halting Problem 原题链接:https://pintia.cn/problem-sets/1036903825309761536/problems/1041156042892824576


#include<bits/stdc++.h>
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<algorithm>
#include<stack>
using namespace std; #define inf 0x3f3f3f3f
typedef long long ll; namespace IO {
const int MT = 10 * 1024 * 1024; /// 10MB 请注意输入数据的大小!!!
char IO_BUF[MT];
int IO_PTR, IO_SZ;
/// 要记得把这一行添加到main函数第一行!!!
void begin() {
IO_PTR = 0;
IO_SZ = fread (IO_BUF, 1, MT, stdin);
}
template<typename T>
inline bool scan_d (T & t) {
while (IO_PTR < IO_SZ && IO_BUF[IO_PTR] != '-' && (IO_BUF[IO_PTR] < '0' || IO_BUF[IO_PTR] > '9'))
IO_PTR ++;
if (IO_PTR >= IO_SZ) return false;
bool sgn = false;
if (IO_BUF[IO_PTR] == '-') sgn = true, IO_PTR ++;
for (t = 0; IO_PTR < IO_SZ && '0' <= IO_BUF[IO_PTR] && IO_BUF[IO_PTR] <= '9'; IO_PTR ++)
t = t * 10 + IO_BUF[IO_PTR] - '0';
if (sgn) t = -t;
return true;
}
inline bool scan_s (char s[]) {
while (IO_PTR < IO_SZ && (IO_BUF[IO_PTR] == ' ' || IO_BUF[IO_PTR] == '\n') ) IO_PTR ++;
if (IO_PTR >= IO_SZ) return false;
int len = 0;
while (IO_PTR < IO_SZ && IO_BUF[IO_PTR] != ' ' && IO_BUF[IO_PTR] != '\n')
s[len ++] = IO_BUF[IO_PTR], IO_PTR ++;
s[len] = '\0';
return true;
}
template<typename T>
void print(T x) {
static char s[33], *s1; s1 = s;
if (!x) *s1++ = '0';
if (x < 0) putchar('-'), x = -x;
while(x) *s1++ = (x % 10 + '0'), x /= 10;
while(s1-- != s) putchar(*s1);
}
template<typename T>
void println(T x) {
print(x); putchar('\n');
}
};
using namespace IO;
using namespace std; char ins[10005];
int a[10005];
int b[10005];
bool vis[10005][300];
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif // ONLINE_JUDGE
begin();
int t;
scan_d(t);char opt[10];
int n;
int v,k;
int r;
while(t--)
{
memset(vis,0,sizeof(vis));
scan_d(n);
r=0;
int n2=n;
int cnt=1;
while(n--)
{
scan_s(opt);
if(opt[1]=='d')
{
scan_d(v);
ins[cnt]=opt[1];
a[cnt]=v;
cnt++;
}
else if(opt[1]=='e')
{
scan_d(v);
scan_d(k);
ins[cnt]=opt[1];
a[cnt]=v;
b[cnt]=k;
cnt++;
}
else if(opt[1]=='n')
{
scan_d(v);
scan_d(k);
ins[cnt]=opt[1];
a[cnt]=v;
b[cnt]=k;
cnt++;
}
else if(opt[1]=='l')
{
scan_d(v);
scan_d(k);
ins[cnt]=opt[1];
a[cnt]=v;
b[cnt]=k;
cnt++;
}
else if(opt[1]=='g')
{
scan_d(v);
scan_d(k);
ins[cnt]=opt[1];
a[cnt]=v;
b[cnt]=k;
cnt++;
}
} int i=1;
bool f=1;char op;
while(i!=(n2+1))
{
if(i<=0||i>n2+1){f=0;break;}
op=ins[i];
if(op=='d')
{
if(!vis[i][r]){vis[i][r]=1;}
else {f=0;break;}
r=(r+a[i])%256;
}
else if(op=='e')
{if(!vis[i][r]){vis[i][r]=1;}
else {f=0;break;}
if(r==a[i]){i=b[i];continue;}
}
else if(op=='n')
{
if(!vis[i][r]){vis[i][r]=1;}
else {f=0;break;}
if(r!=a[i]){i=b[i]; continue;}
}
else if(op=='l')
{if(!vis[i][r]){vis[i][r]=1;}
else {f=0;break;}
if(r<a[i]){i=b[i];
continue;}
}
else if(op=='g')
{
if(!vis[i][r]){vis[i][r]=1;}
else {f=0;break;}
if(r>a[i]){i=b[i];
continue;}
}
i++;
} if(f)puts("Yes");
else puts("No"); } return 0; }

H Traveling on the Axis 原题链接:https://pintia.cn/problem-sets/1036903825309761536/problems/1041156323504345088

队友代码:

#include <bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <iostream>
#include <stack>
#define rep(i,n) for(int i=0;i<(n);i++)
#define mst(x,i) memset(x,i,sizeof(x))
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long ll;
const int maxn = 1e5+5;
char s[maxn]; ll c[maxn],sumc[maxn],sum0[maxn],sumcc[maxn];
int n; void solve() {
n = strlen(s);
c[0]=0;
for(int i=1;i<n;i++) {
if(s[i]==s[i-1]) {
c[i]=1;
}else {
c[i]=0;
}
} sumc[0]=0;
for(int i=1;i<n;i++) {
sumc[i]=sumc[i-1]+c[i];
} if(s[0]=='0') sum0[0]=1;
else sum0[0]=0; for(int i=1;i<n;i++) {
int f=1-(s[i]-'0');
sum0[i]=sum0[i-1]+f;
} sumcc[0]=sumc[0];
for(int i=1;i<n;i++) {
int f=0;
if(c[i]) f=i;
sumcc[i]=sumcc[i-1]+f;
} ll ans=0;
for(ll i=1;i<=n;i++) {
ans += i*(i+1)/2;
ans += sumcc[i-1];
ans += sum0[i-1];
}
cout<<ans<<endl;
} int main() {
#ifndef ONLINE_JUDGE
freopen("data.in","r",stdin);
#endif
int T;
scanf("%d",&T);
while(T--) {
scanf("%s",s);
solve();
}
}

K XOR Clique 原题链接:https://pintia.cn/problem-sets/1036903825309761536/problems/1041156503909756928

队友代码:

#include <bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <iostream>
#include <stack>
#define rep(i,n) for(int i=0;i<(n);i++)
#define mst(x,i) memset(x,i,sizeof(x))
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long ll;
const int maxn = 1e5+5;
int a[maxn],n;
int c[64]; void solve() {
for(int i=0;i<n;i++) {
for(int j=31;j>=0;j--) {
if( (1<<j)&a[i] ) {
c[j]++;
break;
}
}
}
int ans=-1;
for(int i=0;i<32;i++) ans=max(ans,c[i]);
cout<<ans<<endl;
} int main() {
#ifndef ONLINE_JUDGE
freopen("data.in","r",stdin);
#endif
int T;
scanf("%d",&T);
while(T--) {
scanf("%d",&n);
memset(c,0,sizeof(c));
for(int i=0;i<n;i++) scanf("%d",&a[i]);
solve();
}
return 0;
}

The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online(2018 青岛网络预选赛)的更多相关文章

  1. The 2018 ACM-ICPC Asia Qingdao Regional Contest(部分题解)

    摘要: 本文是The 2018 ACM-ICPC Asia Qingdao Regional Contest(青岛现场赛)的部分解题报告,给出了出题率较高的几道题的题解,希望熟悉区域赛的题型,进而对其 ...

  2. The 2018 ACM-ICPC Asia Qingdao Regional Contest

    The 2018 ACM-ICPC Asia Qingdao Regional Contest 青岛总体来说只会3题 C #include<bits/stdc++.h> using nam ...

  3. 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 ...

  4. 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 ...

  5. The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online J - Press the Button(思维)

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4056 题意 有一个按钮.一个灯.一个计时器和一个计数器,每按一次按钮,计时 ...

  6. 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 ...

  7. 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 ...

  8. 2018-2019, ICPC, Asia Yokohama Regional Contest 2018 K

    传送门:https://codeforces.com/gym/102082/attachments 题解: 代码: /** * ┏┓ ┏┓ * ┏┛┗━━━━━━━┛┗━━━┓ * ┃ ┃ * ┃ ━ ...

  9. ZOJ - 4048 Red Black Tree (LCA+贪心) The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online

    题意:一棵树上有m个红色结点,树的边有权值.q次查询,每次给出k个点,每次查询有且只有一次机会将n个点中任意一个点染红,令k个点中距离红色祖先距离最大的那个点的距离最小化.q次查询相互独立. 分析:数 ...

随机推荐

  1. spark的安装步骤

    官网:http://spark.apache.org/downloads.html 安装:tar -zxvf spark-2.4.3-bin-hadoop2.7.tgz#配置环境变量(vim ~/.b ...

  2. 【xlwings】 wps 和 office 的excel creat_sheet区别

    最近在学习 xlwings,参考学习的网址:https://www.jianshu.com/p/b534e0d465f7 写得很棒,学到了很多. 在新建sheet表单, 发现一个问题. import ...

  3. error: [Errno 13] Permission denied: '/usr/local/lib/处理方法

    在ubuntu系统下使用pip 命令安装包时,出现以下类似错误提示: error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/di ...

  4. PBOC第八部分和第十一部分关于TYPEA总结(二)——传输协议(ISO14443-4)

    二.传输协议(ISO14443-4)(8,P50 11,P30) 1.选择应答请求(RATS) 使用RATS命令和PICC协商通讯的最大帧长度(FSD和FSC).帧等待时间(FWT)和启动帧保护时间( ...

  5. frp基础操作

    [common]privilege_mode = true privilege_token = ****bind_port = 7000 dashboard_user = 444444dashboar ...

  6. webpack自定义loader并发布

    一.官网对loader的解释: 1.loader 是导出为一个函数的 node 模块.该函数在 loader 转换资源的时候调用.给定的函数将调用 loader API,并通过 this 上下文访问. ...

  7. ajax-springMVC提交表单的方式

    1.request参数提交(Form提交),适用于GET/POST request参数传递都会转换成 id=123&fileName=test.name&type=culture_ar ...

  8. Java Web ActiveMQ与WebService的异同

    Webservice 和MQ(MessageQueue)都是解决跨平台通信的常用手段 一.WebService:用来远程调用服务,达到打通系统.服务复用的目的.是SOA系统架构——面向服务架构的体现. ...

  9. WAV格式文件无损合并&帧头数据体解析(python)(原创)

    一,百度百科 WAV为微软公司(Microsoft)开发的一种声音文件格式,它符合RIFF(Resource Interchange File Format)文件规范,用于保存Windows平台的音频 ...

  10. RedisCluster 添加/删除节点

    一,redis cluster命令行 //集群(cluster) CLUSTER INFO 打印集群的信息 CLUSTER NODES 列出集群当前已知的所有节点(node),以及这些节点的相关信息. ...