前言:果然自己连\(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. PG集群(PostgreSql环境)搭建

    centos PG集群搭建 一.安装PG 1.安装之前首先查看软件是否已经安装 rpm -qa | grep postgresql #若存在,需要卸载使用 yum remove postgresql ...

  2. 【数学】快速傅里叶变换(FFT)

    快速傅里叶变换(FFT) FFT 是之前学的,现在过了比较久的时间,终于打算在回顾的时候系统地整理一篇笔记,有写错的部分请指出来啊 qwq. 卷积 卷积.旋积或褶积(英语:Convolution)是通 ...

  3. Golang通脉之方法

    方法和接收者 Go语言中的方法(Method)是一种作用于特定类型变量的函数.这种特定类型变量叫做接收者(Receiver).接收者的概念就类似于其他语言中的this或者 self. Go 语言中同时 ...

  4. 初学Python-day7 案例(乘法口诀 已更新!!)

    案例::(乘法口诀)  用for循环做乘法口诀: 1 # 第一种 2 for i in range(1, 10): 3 for j in range(1, i + 1): 4 print('{} * ...

  5. python jinja2初见

    吸取了长城杯的教训,学习python-web迫在眉睫. 正常难度的python_template_injection,由于现在没学面向对象,理解原理比较困难,所以先使用简单版复现:并附上正常版的常用p ...

  6. 热身训练1 Calculator

    题目出处:Calculator 简要题意: 你有一个确定的函数,f(x)=+...*...^...,其中共有n个操作,从左到右依次计算. 共有m次询问,我们每次询问,1.会修改f(x)中的操作:2.输 ...

  7. Linux下Zabbix5.0 LTS监控基础原理及安装部署(图文教程)

    Zabbix 是什么? zabbix 是一个基于 Web 界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.通过 C/S 模式采集数据,通过 B/S 模式在 Web 端展示和配置,能监视 ...

  8. 【Azure 应用服务】App Service For Linux 部署Java Spring Boot应用后,查看日志文件时的疑惑

    编写Java Spring Boot应用,通过配置logging.path路径把日志输出在指定的文件夹中. 第一步:通过VS Code创建一个空的Spring Boot项目 第二步:在applicat ...

  9. 【代码更新】单细胞分析实录(20): 将多个样本的CNV定位到染色体臂,并画热图

    之前写过三篇和CNV相关的帖子,如果你做肿瘤单细胞转录组,大概率看过: 单细胞分析实录(11): inferCNV的基本用法 单细胞分析实录(12): 如何推断肿瘤细胞 单细胞分析实录(13): in ...

  10. web性能检测工具lighthouse

    About Automated auditing, performance metrics, and best practices for the web. Lighthouse 可以自动检查Web页 ...