前言:果然自己连\(ABC\)都打不好了吗。

没看清题目,卡了巨久,排名一直跌,笔记本键盘坏了,心态崩了。

冷静。

——————————————————————————————————————————————————————

\(A\)

判断一个年份处于几世纪。

A
// code by fhq_treap
#include<bits/stdc++.h>
#define ll long long
#define N 300005 inline ll read(){
char C=getchar();
ll A=0 , F=1;
while(('0' > C || C > '9') && (C != '-')) C=getchar();
if(C == '-') F=-1 , C=getchar();
while('0' <= C && C <= '9') A=(A << 1)+(A << 3)+(C - 48) , C=getchar();
return A*F;
} struct P{
int to,next;
}; struct Map{
P e[N << 1];
int head[N],cnt;
Map(){
std::memset(head,0,sizeof(head));
cnt = 0;
}
inline void add(int x,int y){
e[++cnt].to = y;
e[cnt].next = head[x];
head[x] = cnt;
}
}; ll a;
ll ans = 0; int main(){
scanf("%lld",&a);
ans = (a / 100) + (a % 100 != 0);
std::cout<<ans<<std::endl;
}

\(B\)

按题意模拟就行。

B
// code by fhq_treap
#include<bits/stdc++.h>
#define ll long long
#define N 300005 inline ll read(){
char C=getchar();
ll A=0 , F=1;
while(('0' > C || C > '9') && (C != '-')) C=getchar();
if(C == '-') F=-1 , C=getchar();
while('0' <= C && C <= '9') A=(A << 1)+(A << 3)+(C - 48) , C=getchar();
return A*F;
} struct P{
int to,next;
}; struct Map{
P e[N << 1];
int head[N],cnt;
Map(){
std::memset(head,0,sizeof(head));
cnt = 0;
}
inline void add(int x,int y){
e[++cnt].to = y;
e[cnt].next = head[x];
head[x] = cnt;
}
}; ll a,k; int main(){
a = read(),k = read();
for(int i = 1;i <= k;++i){
if(a % 200 == 0)
a /= 200;
else
a = a * 1000 + 200;
}
std::cout<<a<<std::endl;
}

\(C\)

从左往右扫,按前缀和的膜分类一下就能统计了。

C
// code by fhq_treap
#include<bits/stdc++.h>
#define ll long long
#define N 300005 inline ll read(){
char C=getchar();
ll A=0 , F=1;
while(('0' > C || C > '9') && (C != '-')) C=getchar();
if(C == '-') F=-1 , C=getchar();
while('0' <= C && C <= '9') A=(A << 1)+(A << 3)+(C - 48) , C=getchar();
return A*F;
} struct P{
int to,next;
}; struct Map{
P e[N << 1];
int head[N],cnt;
Map(){
std::memset(head,0,sizeof(head));
cnt = 0;
}
inline void add(int x,int y){
e[++cnt].to = y;
e[cnt].next = head[x];
head[x] = cnt;
}
}; ll mod[300];
ll n,a[500005];
ll ans = 0; int main(){
scanf("%lld",&n);
for(int i = 1;i <= n;++i){
a[i] = read();
ans += mod[a[i] % 200];
mod[a[i] % 200] ++;
}
std::cout<<ans<<std::endl;
}

\(D\)

五分钟写完三题,感觉良好。

这题一眼看错了题意,以为不能有相同元素,于是乎写了正确算法交了三发\(WA\)然后就不想打了。

认真看题,不然人没。

一眼看出鸽笼原理,所以只要枚举一群数量大于\(200\),复杂度在接受范围里的就行。

D
#include<iostream>
#include<cstdio>
#define ll long long
#define N 500 ll n,a[N]; inline ll read(){
ll ans = 0,f = 1;
char a = getchar();
while(a < '0' || a > '9' && a != '-')a = getchar();
if(a == '-')
f = -1,a = getchar();
while(a <= '9' && a >= '0')
ans = (ans << 3) + (ans << 1) + (a - '0'),a = getchar();
return ans;
} ll mod[N]; inline void print(ll a,ll b){
puts("Yes");
ll x = 0;
for(int i = 0;i <= std::min(n - 1,(ll)10);++i)
if((a >> i) & 1)
x ++ ;
std::cout<<x<<" ";
for(int i = 0;i <= std::min(n - 1,(ll)10);++i)
if((a >> i) & 1)
std::cout<<(i + 1)<<" ";
a = b,x = 0;
puts("");
for(int i = 0;i <= std::min(n - 1,(ll)10);++i)
if((a >> i) & 1)
x ++ ;
std::cout<<x<<" ";
for(int i = 0;i <= std::min(n - 1,(ll)10);++i)
if((a >> i) & 1)
std::cout<<(i + 1)<<" ";
} int main(){
n = read();
for(int i = 1;i <= n;++i)
a[i] = read() % 200;
for(int i = 1;i <= (1 << std::min(n - 1,(ll)10));++i){
ll s = 0;
for(int j = 0;j <= std::min(n - 1,(ll)10);++j)
if((i >> j) & 1)
s = (s + a[j + 1]) % 200;
if(mod[s]){
print(mod[s],i);
return 0;
}else{
mod[s] = i;
}
}
puts("No");
}

\(E\)

这题的关键点在于,如何快速求出三元组和为\(s\)的数量。

找到答案所在的块内后,完全可以枚举第一,第二个数求解。

考虑找规律,规律见程序。

很抱歉这里说不清。

E
#include <cstdio>
#include <algorithm>
using namespace std;
long long dp[4][3000005];
int ans[4];
int main()
{
int n,st;
long long k,sum,now;
int all;
scanf("%d%lld",&n,&k);
dp[0][0]=1;
for(int i=1;i<=3;i++)
{
sum=0;
for(int j=0;j<=i*n;j++)
{
dp[i][j]=sum;
sum+=dp[i-1][j];
if(j>=n)
sum-=dp[i-1][j-n];
}
}
now=0;
for(int i=0;i<=3*n;i++)
{
now+=dp[3][i];
if(now>=k)
{
all=i;
k-=now-dp[3][i];
break;
}
}
now=0;
for(int i=1;i<=n;i++)
{
now+=dp[2][all-i];
if(now>=k)
{
ans[1]=i;
for(int j=1;j<=n;j++)
if(all-ans[1]-j>=1&&all-ans[1]-j<=n)
{
ans[2]=j;
ans[3]=all-ans[1]-ans[2];
break;
}
for(int j=0;j<k-(now-dp[2][all-i])-1;j++)
{
ans[2]++;
ans[3]--;
}
printf("%d %d %d\n",ans[1],ans[2],ans[3]);
break;
}
}
return 0;
}

F找时间补上。

AtCoder Beginner Contest 200的更多相关文章

  1. KYOCERA Programming Contest 2021(AtCoder Beginner Contest 200) 题解

    KYOCERA Programming Contest 2021(AtCoder Beginner Contest 200) 题解 哦淦我已经菜到被ABC吊打了. A - Century 首先把当前年 ...

  2. Atcoder Beginner Contest 200 E. Minflip Summation(概率数论)

    题面 一个字符串 T T T 是由一个包含 0.1.? 的字符串 S S S 循环连接 K K K 次获得的. 字符串 T T T 中的每个 ? 都可以换成 0 或 1 ,假设 T T T 中一共有 ...

  3. AtCoder Beginner Contest 100 2018/06/16

    A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...

  4. AtCoder Beginner Contest 053 ABCD题

    A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...

  5. AtCoder Beginner Contest 076

    A - Rating Goal Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Takaha ...

  6. AtCoder Beginner Contest 068 ABCD题

    A - ABCxxx Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement This contes ...

  7. AtCoder Beginner Contest 052

    没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder ...

  8. AtCoder Beginner Contest 136

    AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using na ...

  9. AtCoder Beginner Contest 137 F

    AtCoder Beginner Contest 137 F 数论鬼题(虽然不算特别数论) 希望你在浏览这篇题解前已经知道了费马小定理 利用用费马小定理构造函数\(g(x)=(x-i)^{P-1}\) ...

随机推荐

  1. GPIO位带操作点亮LED,且使用按键控制开关

    1. 项目 类似与C51单片机的位操作使能引脚来点亮LED. 例如,sbit P0^0 = 0 LED1 = P0^0; 2. 代码 main.c #include "stm32f10x.h ...

  2. javascript-jquery-文档处理

    一.移动元素 1.append():向每个匹配元素的内部追加内容.例如:$("选择器1").qppend("选择器2"):将会匹配选择器2的元素,移动到匹配选择 ...

  3. 防止SQL注入总结

    1.预编译(占位符)可以很大程度上防止SQL注入 预编译的原理是数据库厂商提供的JAR包中,对参数进行了转义 2.mybatis中,能用# 的地方,不用$,因为#是预编译占位符形式,可以防止SQL注入 ...

  4. Github Actions 实践

    Github Actions 实践 Github Actions 是 Github 的持续集成服务,通过在 repo 发生特定的行为时执行指定的命令实现自动测试.自动部署等功能. 基本术语 workf ...

  5. Manjaro / ArchLinux 安装网易云音乐解决搜索不能输入中文方法

    0. 安装网易云音乐 yay -S netease-cloud-music 1.先安装qcef这个软件包. sudo yay -S qcef 2.编辑/opt/netease/netease-clou ...

  6. Vue 报错Error in render: “TypeError: Cannot read properties of null (reading ‘xxx’)” found in

    前端vue报错 [Vue warn]: Error in render: "TypeError: Cannot read properties of null (reading 'name' ...

  7. 《基于SD-SEIR模型的实验室人员不安全行为传播研究》

    My Focus:基于SD-SEIR模型的实验室人员不安全行为的传播; 建模与实验仿真 Title: Study on Porpagation of Unsafe Bhavior of Laborat ...

  8. HBase的安装与部署

    一.部署前置环境 先部署分布式的高可用版的Hadoop,即ZooKeeper+Hadoop. https://www.cnblogs.com/live41/p/15483192.html * 部署的服 ...

  9. Vivado Synth/Place Faild但是没有给出error信息

    最近遇到一个现象,以前可以编译通过的工程,修改之后发现Synthesis编译报错,而且没有给出error信息,以前也出现过无故place 失败但是没有给出error信息的现象,查看错误日志输出文件,出 ...

  10. Luogu P1538 迎春舞会之数字舞蹈 | 模拟

    题目链接 大水题,暴力输出,代码应该能看吧...... #include<iostream> #include<cstdio> using namespace std; int ...