计蒜客 UCF 2015
# A.Find the twins

# 题意
找出每个序列是否有特定的值
# 题解
坑,原始序列输出的时候每一行最后一个不能有空格
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+;
int a[];
int n;
int main(){
n=;
int t;
cin>>t; for(int k=;k<=t;k++){
bool z=,m=;
for(int i=;i<=n;i++){
cin>>a[i];
if(a[i]==)
m=;
if(a[i]==)
z=;
} for(int i=;i<=n;i++) {
if(i!=n)
printf("%d ",a[i]);
else
printf("%d",a[i]);
}
puts("");
if(m&&z) {
puts("both");
}
else if(m) {
puts("mack");
}
else if(z) {
puts("zack");
}
else {
puts("none");
}
puts("");
} }
# B.Medal Ranking 
# 题解
水题一样还是最后一行空格
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+;
int a[];
int n;
int main(){
n=;
int t;
cin>>t; for(int k=;k<=t;k++){
bool cnt=,col=;
int m1,m2,m3;
int r1,r2,r3;
cin>>m1>>m2>>m3;
cin>>r1>>r2>>r3;
int summ=m1+m2+m3;
int sumr=r1+r2+r3;
if(summ>sumr)
cnt=; if(m1 > r1)
col=;
if(m1 == r1){
if(m2>r2)
col=;
if(m2==r2){
if(m3>r3)
col=;
}
} cout<<m1<<' '<<m2<<' '<<m3<<' '<<r1<<' '<<r2<<' '<<r3<<endl;
if(col && cnt)
cout<<"both"<<endl;
else if(cnt)
cout<<"count"<<endl;
else if(col)
cout<<"color"<<endl; else cout<<"none"<<endl;
puts("");
} }
# C. Cookies


# 题解
饼干不够就切
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+;
int main(){
int t;
cin>>t;
for(int i=;i<=t;i++){
int n,cnt;
cin>>n>>cnt;
printf("Practice #%d: %d %d\n",i,n,cnt);
int m;
cin>>m;
for(int j=;j<=m;j++){
int x;
cin>>x;
while(x>=cnt)
cnt*=;
cnt-=x;
cout<<x<<' '<<cnt<<endl;
}
puts("");
} }
# D. Lemonade Stand


# 题意
一个柠檬水店,每一杯柠檬水的制作需要糖和柠檬,知道每天都会来多少人,每天柠檬和糖的原材料价格都不一样,
每天可以买任意多的和任意少的,每天的所有客人都要被满足,每天的价格是单个柠檬的价格和80 盎司糖的价格,剩下的原料第二天可以使用。
# 题解
从前往后只记录之前的价格的最小值即可,因为糖只能一包一包买也就是80盎司,
第二天可以使用第一天剩余的,并且只能第二天使用,剩余的一定小于80盎司。
#include <bits/stdc++.h>
#define ll long long
using namespace std;
struct node{
ll cnt,pl,ps;
}day[];
void work(){
ll d,x,y;
cin>>d>>x>>y;
day[].pl=INT_MAX;
day[].ps=INT_MAX;
for(int i=;i<=d;i++){
cin>>day[i].cnt>>day[i].pl>>day[i].ps;
day[i].pl=min(day[i].pl,day[i-].pl);
day[i].ps=min(day[i].ps,day[i-].ps);
} ll ans=,now_r=;
for(int i=;i<=d;i++){ ans+=day[i].cnt*x*day[i].pl;
now_r-=day[i].cnt * y;
while(now_r<){
now_r+=;
ans+=day[i].ps;
}
//ll need=day[i].cnt*y;
//need-=now_r; /*if(need > 80 && need % 80){
now_r = (need/80+1)*80 - need;
ans+=(need / 80 +1) * day[i].ps;
}
else if(need > 80 && !(need % 80)){
now_r= 0;
ans+=need/80 * day[i].ps;
}
else if(need<80){
now_r=80-need;
ans+=day[i].ps;
}
*/ }
cout<<ans<<endl;
}
int main(){
int t;
cin>>t;
while(t--){
work();
}
}
# E.Rain Gauge

# 题意
即给定一个正方形和圆,求圆覆盖正方形的面积
# 题解
分成三种情况,两种正好的情况直接计算,另一种求出来出来的面积,圆的面积减去即可
利用反三角函数,反三角函数返回的是弧度制
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const double pi=3.14159265358979;
int main(){
int t;
cin>>t;
for(int i=;i<=t;i++){
double s,r;
cin>>s>>r;
double d=s/;
double p=sqrt()*d;
double ans;
if(r>=p) {
ans = s*s;
}
else if(r<=d)
ans=pi*r*r;
else if(r<p && r>d){
double c= sqrt(r*r-d*d);
double rec=c*d;
double jd=*acos(d/r);
double cir=jd*r*r/;
double la=cir-rec;
ans = pi*r*r-*la;
}
cout<<fixed<<setprecision()<<ans<<endl;
} }
# G.Towers of Hanoi grid 


# 题意
n*n的网格,从(1,1)中的d个从上到下递减的塔移动到(n,n)点上去,
除了(1,1)和(n,n)以外其余的点只能放一个塔,如果能移动求最少的移动次数,如果不行输出impossible
# 题解
画图易知必须有一条可行的哈密顿路径供最下面的塔移动到(n,n)
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
int t;
cin>>t;
for(int i=;i<=t;i++){
int d,n;
cin>>d>>n;
if(d > (n-)*(n-)+)
cout<<"Grid #"<<i<<": "<<"impossible"<<endl;
else
cout<<"Grid #"<<i<<": "<<d*(n-)*<<endl;
puts("");
}
return ; }
计蒜客 UCF 2015的更多相关文章
- 计蒜客:Entertainment Box
Ada, Bertrand and Charles often argue over which TV shows to watch, and to avoid some of their fight ...
- 计蒜客 作弊揭发者(string的应用)
鉴于我市拥堵的交通状况,市政交管部门经过听证决定在道路两侧安置自动停车收费系统.当车辆驶入车位,系统会通过配有的摄像头拍摄车辆画面,通过识别车牌上的数字.字母序列识别车牌,通过连接车管所车辆信息数据库 ...
- 计蒜客的一道题dfs
这是我无聊时在计蒜客发现的一道题. 题意: 蒜头君有一天闲来无事和小萌一起玩游戏,游戏的内容是这样的:他们不知道从哪里找到了N根不同长度的木棍, 看谁能猜出这些木棍一共能拼出多少个不同的不等边三角形. ...
- 计蒜客模拟赛5 D2T1 成绩统计
又到了一年一度的新生入学季了,清华和北大的计算机系同学都参加了同一场开学考试(因为两校兄弟情谊深厚嘛,来一场联考还是很正常的). 不幸的是,正当老师要统计大家的成绩时,世界上的所有计算机全部瘫痪了. ...
- 计蒜客 等边三角形 dfs
题目: https://www.jisuanke.com/course/2291/182238 思路: 1.dfs(int a,int b,int c,int index)//a,b,c三条边的边长, ...
- 计蒜客 方程的解数 dfs
题目: https://www.jisuanke.com/course/2291/182237 思路: 来自:https://blog.csdn.net/qq_29980371/article/det ...
- 计蒜客 买书 dfs
题目: https://www.jisuanke.com/course/2291/182236 思路: 递归解决,从第一本书开始,每本书都有两种选择: //index是book里面每本书价格的下标, ...
- 爬虫acm比赛成绩(多页成绩整合在一起、获取复制不了的数据)(hihocoder、计蒜客)
https://github.com/congmingyige/web-crawler_rank-of-competition-in-JiSuanKe-and-hihocoder 1. 计蒜客(获取复 ...
- 计蒜客 31436 - 提高水平 - [状压DP]
题目链接:https://nanti.jisuanke.com/t/31436 作为一名车手,为了提高自身的姿势水平,平时的练习是必不可少的.小 J 每天的训练包含 $N$ 个训练项目,他会按照某个顺 ...
随机推荐
- python学习--quote()函数
屏蔽特殊的字符.比如如果url里面的空格!url里面是不允许出现空格的. 在 Python2.x 中的用法是:urllib.quote(text)Python3.x 中是urllib.parse.qu ...
- CCF_201612-4_交通规划
http://115.28.138.223/view.page?gpid=T44 好像也没想象中的那么难,没办法,当初连个优先队列dij都不会写= = 在优先队列dij算法上加上相等的时候的处理就可以 ...
- 基于MXNet的im2rec.py的debug
1.im2rec.py调试错误:multiprocessing not available, fall back to single threaded encoding imread 经过查找发现是程 ...
- Visual Studio 2015 配置 Python 环境
Visual Studio 2015可以在安装时选择安装Python环境,首次使用VS2015执行python时需要配置环境变量: 配置VS2015的环境前需要先下载Python并安装: https: ...
- Python 模拟登录几种常见方法
方法一:直接使用已知的cookie访问 优点: 简单,但需要先在浏览器登录 原理: 简单地说,cookie保存在发起请求的客户端中,服务器利用cookie来区分不同的客户端.因为http是一种无状态的 ...
- JS设计模式——策略模式
设计模式高大上,业务代码用不上...平时用不上我们就可以忽略了吗? 非也,就像面试造火箭,工作拧螺丝一样.万一我们公司哪天要造火箭了,你得立马能上手. 同时,有些复杂的业务代码也可以用设计模式的思想去 ...
- HTML页面缓存
引出问题: 在做完一个项目迭代上线的时候遇到一个问题:Ht代码部署在nginx里面,当我打包的H5代码上传把之前代码替换掉之后,如果手机端之前有打开过相关的页面,那么在代码上传成功后再次打开,回出现一 ...
- 让div充满整个body
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 细读jsr中的yield语义,或者不是我们想象中的那样
这只是我的个人观点,如有错误,希望你可以指出. 首先英文原版 中文译版 我觉得“不需要”还会让人产生误解,应该译为不一定要. 很多时候会被断章取义地理解,我们一定要有“不一定”,“可能”的意识,下面给 ...
- go程序基于阿里云CodePipeline的一次devops实践
背景 最近朋友有个项目代码托管用的码云,测试服务器(阿里云ECS)只有一台,三四个人开发,于是想基于阿里云的CodePipeline快速打造一套自动化cicd的流程,使用docker来进行多套环境部署 ...