CodeForces 70
A题
#include<bits/stdc++.h>
using namespace std;
int n,b,sum;
int main(){
scanf("%d",&n);
if (n==0){
printf("1\n");
return 0;
}
int b=3,sum=1;
for (int i=1;i<n;++i)
sum=(sum*b)%1000003;
printf("%d",sum);
return 0;
}
B题
难得我能在一群大佬中抢个一血的题
#include<bits/stdc++.h>
using namespace std;
string s;
vector<int>a;
int n,m,ans;
int main(){
scanf("%d",&n),m=1;
getline(cin,s);getline(cin,s);
for(register int i=0;i<s.size();++i)
if(s[i]!='?'&&s[i]!='.'&&s[i]!='!')
++m;
else if(m>n){
printf("Impossible\n");
return 0;
}
else a.push_back(m),m=0;
for(register int i=0;i<a.size();++i)
if(m+a[i]+1<=n&&m>0)
m+=a[i]+1;
else
++ans,m=a[i];
printf("%d\n",ans);
return 0;
}
C题 (siyuan)
#include <bits/stdc++.h>
#define MAXN 100010
using namespace std;
int maxx,maxy,w,b,cd,x;
pair<int,int> f[MAXN],f1[MAXN],ans;
map<pair<int,int>,int> a,b1;
inline pair<int,int> sc(int maxx,int maxy,int w){
int x=MAXN,y=MAXN;
for(int i=1,j=0,s=0;i<=maxx;++i){
a[f[i]]++,s+=b1[f1[i]];
while(s<w&&j<maxy)
s+=a[f1[++j]],b1[f[j]]++;
while(j>0&&s-a[f1[j]]>=w)
s-=a[f1[j]],b1[f[j]]--,j--;
if(s>=w&&(1LL*i*j<1LL*x*y))
x=i,y=j;
}
return pair<int,int>(x,y);
}
int main(){
scanf("%d%d%d",&maxx,&maxy,&w);
for(int i=1;i<=max(maxx,maxy);i++){
b=0,x=i;
while (x) b=b*10+x%10,x/=10;
cd=__gcd(i,b);
f[i]=pair<int,int>(i/cd,b/cd);
f1[i]=pair<int,int>(b/cd,i/cd);
}
ans=sc(maxx,maxy,w);
if(ans.first==100010)
printf("-1\n");
else
printf("%d %d\n",ans.first,ans.second);
return 0;
}
D题
517昨天刚刚讲过的题,可我还是不会,我太菜了
#include <bits/stdc++.h>
using namespace std;
const double MIN=1e-8;
const double pi=3.141592653589793238462643383;
int q,i,c,x[10],y[10],xx,yy,x1,x2,yy1,y2;
struct Node{
double a,b,c,d;
Node(double x=0,double y=0){
a=x,b=y,c=sqrt(x*x+y*y);
if (abs(x)<MIN){
if (y>MIN)
d=pi*0.5;
else d=pi*(-0.5);
}
else{
if (x>MIN)
d=atan(y/x);
else{
if (y>MIN)
d=pi+atan(y/x);
else
d=-pi+atan(y/x);
}
}
}
}p;
Node operator-(Node a,Node b){
return Node(a.a-b.a,a.b-b.b);
}
double operator*(Node a,Node b){
return a.a*b.b-a.b*b.a;
}
bool operator<(Node a,Node b){
if (a.d==b.d)
return a.c<b.c;
else
return a.d<b.d;
}
bool operator>(Node a,Node b){
if (a.d==b.d)
return a.c>b.c;
else
return a.d>b.d;
}
set<Node>s;
set<Node>::iterator s1;
set<Node>::iterator nex(set<Node>::iterator x){
x++;
if (x==s.end())
return s.begin();
else
return x;
}
set<Node>::iterator pre(set<Node>::iterator x){
if (x==s.begin())
x=s.end();
x--;
return x;
}
int main(){
scanf("%d",&q);q-=3;
for (int i=0;i<3;++i){
scanf("%d%d%d",&c,&x[i],&y[i]);
x1=x1+x[i],yy1=yy1+y[i];
}
x1/=3.0,yy1/=3.0;
for (int i=0;i<3;++i)
s.insert(Node(x[i]-x1,y[i]-yy1));
while (q--){
scanf("%d%d%d",&c,&x2,&y2);
xx=x2-x1,yy=y2-yy1;
p=Node(xx,yy);
s1=s.lower_bound(p);
if(s1==s.end())
s1=s.begin();
if (c==1){
if ((p-*pre(s1))*(*s1-p)>MIN){
s.insert(p);
s1=nex(s.find(p));
while (s.size()>3&&(*s1-p)*(*nex(s1)-*s1)<MIN){
s.erase(s1);
s1=nex(s.find(p));
}
s1=pre(s.find(p));
while (s.size()>3&&(*s1-*pre(s1))*(p-*s1)<MIN){
s.erase(s1);
s1=pre(s.find(p));
}
}
}
else {
if ((p-*pre(s1))*(*s1-p)<MIN)
printf("YES\n");
else
printf("NO\n");
}
}
return 0;
}
E题
这题就不放自己的代码了,siyuan小姐姐真的tql%%%
CodeForces 70的更多相关文章
- codeforces 70 D. Professor's task 动态凸包
地址:http://codeforces.com/problemset/problem/70/D 题目: D. Professor's task time limit per test 1 secon ...
- Codeforces Beta Round #70 (Div. 2)
Codeforces Beta Round #70 (Div. 2) http://codeforces.com/contest/78 A #include<bits/stdc++.h> ...
- 水题 Codeforces Beta Round #70 (Div. 2) A. Haiku
题目传送门 /* 水题:三个字符串判断每个是否有相应的元音字母,YES/NO 下午网速巨慢:( */ #include <cstdio> #include <cstring> ...
- 【55.70%】【codeforces 557A】Ilya and Diplomas
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【22.70%】【codeforces 591C】 Median Smoothing
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- Codeforces 331A2 - Oh Sweet Beaverette (70 points)
贪心搞就行,用map记录每个数出现的下标,每次都取首尾两个.将中间权值为负的删掉后取sum值最大的就行. #include<iostream> #include<algorithm& ...
- 【29.70%】【codeforces 723D】Lakes in Berland
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- Educational Codeforces Round 70 (Rated for Div. 2)
这次真的好难...... 我这个绿名蒟蒻真的要崩溃了555... 我第二题就不会写...... 暴力搜索MLE得飞起. 好像用到最短路?然而我并没有学过,看来这个知识点又要学. 后面的题目赛中都没看, ...
- Educational Codeforces Round 70 题解
噩梦场. 题目出奇的难,好像一群外国老哥看 A 看着看着就哭了-- A 找到 \(b\) 最低的 \(1\),这个 \(1\) 肯定要跟 A 中的一个 \(1\) 搭配,而且是能搭配的 \(1\) 中 ...
随机推荐
- Android 使用Glide加载网络图片等比例缩放
在做android图片加载的时候,由于手机屏幕受限,很多大图加载过来的时候,我们要求等比例缩放,比如按照固定的宽度,等比例缩放高度,使得图片的尺寸比例得到相应的缩放,但图片没有变形.显然按照andro ...
- Redis保证事务一致性,以及常用的数据结构
reids命令可以参考中文官网:http://redis.cn/commands.html 关于reids的使用,可以封装到工具类进行调用: Redis的工具类:JedisAdapter 除了数据结构 ...
- JMeter接口测试 (二) ~ 参数化
对应qq群号:616961231 上篇内容介绍了jmeter的基本使用, 略微提了如何做参数化, 本篇对参数化做进一步深入讲解, 参数化可以将一个变量使用不同数据, 比如有多个用户下单购买商品,调用 ...
- JHipster生成微服务架构的应用栈(一)- 准备工作
本系列文章演示如何用JHipster生成一个微服务架构风格的应用栈. 环境需求:安装好JHipster开发环境的CentOS 7.4(参考这里) 应用栈名称:appstack 认证微服务: uaa 业 ...
- 从0开始的Python学习006流程控制
流程控制语句 Python中有三种控制流程语句: if.for.和while. if语句 使用if语句来校验一个条件,如果条件为真(True),运行if-块,如果为假(False),运行else-块. ...
- UPUPW配置
UPUPW下载地址 https://sourceforge.net/projects/upupw/files/ANK/?tdsourcetag=s_pctim_aiomsg 配置 在这里插入图片描述
- c/c++ llinux epoll系列5 解除epoll_wait状态
linux epoll系列5 解除epoll_wait状态 有时候会有解除epoll_wait状态的需求. 实现方法: 1,给执行epoll_wait的程序发signal. 2,使用sockpair. ...
- 大数据平台Lambda架构详解
Lambda架构由Storm的作者Nathan Marz提出.旨在设计出一个能满足.实时大数据系统关键特性的架构,具有高容错.低延时和可扩展等特. Lambda架构整合离线计算和实时计算,融合不可变( ...
- Docker 镜像仓库
仓库 仓库(Repository)是集中存放镜像的地方. 一个容易混淆的概念是注册服务器(Registry).实际上注册服务器是管理仓库的具体服务器,每个服务器上可以有多个仓库,而每个仓库下面有多个镜 ...
- C#/.NET基于Topshelf创建Windows服务程序及服务的安装和卸载(极速,简洁)
本文首发于:码友网--一个专注.NET/.NET Core开发的编程爱好者社区. 文章目录 C#/.NET基于Topshelf创建Windows服务的系列文章目录: C#/.NET基于Topshelf ...