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. INPUT和CONSTRUCT指令——范例报表查询,作用让用户输入数据,自动生成SQL的WHERE条件,带开窗查询

    INPUT指令 说明:1. 当程序执行到INPUT指令时,会将控制权交给用户,让用户输入数据.2. 用户输入完字段的数据,会将数据回传给程序中的变量接收.3. 只要执行到INPUT的指令,程序会将每个 ...

  2. MySQL的简介、启动及其DDL

    MySQL的各项配置: 默认会启用TCP/IP网络: 默认客户端/服务器端口:3306: 将数据库的BIN目录写入Windows的的path环境变量: 默认不允许root用户在其他机器上远程登录: M ...

  3. .Net面试题三

    1..Net中类和结构的区别? 2.死锁地必要条件?怎么克服? 3.接口是否可以继承接口?抽象类是否可以实现接口?抽象类是否可以继承实体类? 4.构造器COnstructor是否可以被继承?是否可以被 ...

  4. 8.bash编辑命令行

    8.编辑命令行本章介绍 GNU 命令行编辑界面的基本功能.命令行编辑是 Readline 库提供的:这个库被几个不同的程序共用,Bash 是其中一个.使用交互式的 shell 时,默认已经打开了命令行 ...

  5. 【原创】大叔经验分享(59)kudu查看table size

    kudu并没有命令可以直接查看每个table占用的空间,可以从cloudera manager上间接查看 CM is scrapping and aggregating the /metrics pa ...

  6. 【原创】大数据基础之Kudu(4)spark读写kudu

    spark2.4.3+kudu1.9 1 批量读 val df = spark.read.format("kudu") .options(Map("kudu.master ...

  7. luogu P1552 [APIO2012]派遣 题解--可并堆/贪心

    题目链接: https://www.luogu.org/problemnew/show/P1552 分析: 一开始愣是没看懂题,后面发现就是你要找一个树上点集使得各点权值之和小于\(M\),并且找一个 ...

  8. Redis之各版本特性

    1.Redis2.6 Redis2.6在2012年正是发布,经历了17个版本,到2.6.17版本,相对于Redis2.4,主要特性如下: 1)服务端支持Lua脚本. 2)去掉虚拟内存相关功能. 3)放 ...

  9. StringUtils类API及使用方法详解

    StringUtils类API及使用方法详解 StringUtils方法概览 判空函数 1)StringUtils.isEmpty(String str) 2)StringUtils.isNotEmp ...

  10. CentOS7 使用光盘镜像作为yum源

    1. 首先,如果是虚拟机,则确认guest有光驱并且处于激活状态,如果是真机则在光驱中插入光盘 :-) 2. mkdir /media/cdrom mount /dev/cdrom  /media/c ...