福建工程学院第七届ACM程序设计新生赛 (同步赛)
A.关电脑
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int T,h1,m1,s1,h2,m2,s2,t1,t2,ans;
int main(){
while(cin>>T){
for(int cas=;cas<=T;++cas){
cin>>h1>>m1>>s1>>h2>>m2>>s2;
t1=h1*+m1*+s1,t2=h2*+m2*+s2;
ans=t2-t1+(t1>=t2?*:);
cout<<"Case #"<<cas<<": "<<ans<<endl;
}
}
return ;
}
B.保护环境:大的矩形面积减去三个直角三角形的面积即可。
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
double a,b;
int main(){
while(cin>>a>>b){
cout<<setiosflags(ios::fixed)<<setprecision()<<(a+b)*a-a*a/-(a+b)*b/-(a-b)*b/<<endl;
}
return ;
}
C.车厘子的守护士兵1.0
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=;
int n,L,R,l[maxn],r,ans;
int main(){
while(cin>>n>>L>>R){
ans=;
for(int i=;i<=n;++i)cin>>l[i];
for(int i=;i<=n;++i){
cin>>r;
if((L<=i&&i<=R)&&(l[i]<=L&&R<=r))ans++;
}
cout<<ans<<endl;
}
return ;
}
D.内心里的一把火:向量叉积求三角形面积,将以P为起点与之相连的三个三角形面积之和与A、B、C三点构成的三角形面积进行比较即可--->相关博文:向量叉积的运用
#include<bits/stdc++.h>
using namespace std;
struct node{int x,y;}nod[];
int a,b,sum,tmp;
inline int cross(node p0,node p1,node p2){
return abs((p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y-p0.y));
}
int main(){
while(cin>>nod[].x>>nod[].y>>nod[].x>>nod[].y>>nod[].x>>nod[].y){
cin>>nod[].x>>nod[].y,sum=;
for(int i=;i<=;++i)sum+=cross(nod[],nod[i-],nod[i%]);
tmp=cross(nod[],nod[],nod[]);
puts(sum!=tmp?"NO":"YES");
}
return ;
}
E.分配物资
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=1e6+;
int n,m,q,x,y,z,a[maxn],ans[maxn];bool flag[maxn];
int main(){
while(cin>>n>>m>>q){
memset(ans,,sizeof(ans));
memset(flag,false,sizeof(flag));
memset(a,,sizeof(a));
for(int i=;i<=n;++i)cin>>a[i];
for(int i=;i<=m;++i){
cin>>x>>y;
if(a[x]>=y)///物资充足
flag[i]=true,a[x]-=y;
else ans[i]=y-a[x],a[x]=;///同时置0
}
while(q--){
cin>>z;
if(flag[z])puts("Yes");
else cout<<ans[z]<<endl;
}
}
return ;
}
F.吃饭啦
#include<bits/stdc++.h>
using namespace std;
const int maxn=;
int n,m,a[maxn],x,q,ans,pos;
int main(){
while(cin>>n>>m){
memset(a,,sizeof(a));
for(int i=;i<m;++i)cin>>a[i];
sort(a,a+m);
cin>>q;
for(int i=;i<=q;++i){
cin>>x;
pos=lower_bound(a,a+m,x)-a;
///cout<<"os:"<<pos<<endl;
if(pos==m)cout<<x-a[pos-1]<<endl;///找不到,则为x-a[pos-1]
else if(a[pos]==x)puts("0");///如果在某点上,则为0
else if(!pos)cout<<a[]-x<<endl;///如果比第1个点位置小,则为a[0]-x
else cout<<min(a[pos]-x,x-a[pos-])<<endl;///否则就取到两边绝对值最小的即可
}
}
return ;
}
H.约会
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL x,y,a,z;
int main(){
while(cin>>x>>y>>a){
if(x<)x=-x;
if(y<)y=-y;
z=max(x,y);
if((x+y)&)puts("Not the fate");///如果是奇数,则肯定走不到这个位置
else if((!x&&!y&&a)||(a<z)||((a-z)&))puts("You are lying");///特殊情况x==0&&y==0&&a>0,肯定在说谎或者走的步数a小于z,则肯定还没走到或者a>z,则剩下的步数应为偶数,否则肯定是在说谎
else puts("We are together");
}
return ;
}
I.这是一个沙雕题I
#include<bits/stdc++.h>
using namespace std;
char str[];int k,fuck,cnt[];string ans,tmp;bool flag;
int main(){
while(cin>>k){
cin>>str,memset(cnt,,sizeof(cnt)),ans=tmp="",flag=false,fuck=strlen(str);
for(int i=;str[i];++i)cnt[str[i]-'a']++;
for(int i=;i<;++i)
if(cnt[i]&&cnt[i]%k!=)flag=true;///如果不能被k整除,那么肯定不能构成k个相同的字符串
if(flag){puts("-1");continue;}
for(int i=;i<;++i){
if(cnt[i]){///单个字符串拥有该字母的个数为cnt[i]/k
for(int j=;j<=cnt[i]/k;++j)tmp+=i+'a';
}
}
while(k--)ans+=tmp;///重复k次表示重新排列
cout<<ans<<endl;
}
return ;
}
J.这是一个沙雕题II:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n,k,ans,tmp1,tmp2,cnt1,cnt2,i,a[],b[],c[]={};
int main(){
for(i=;i<;++i)c[i]=c[i-]*;///预处理10^i
while(cin>>n>>k){
ans=tmp1=n,tmp2=n-k,cnt1=cnt2=;
while(tmp1)a[cnt1++]=tmp1%,tmp1/=,b[cnt2++]=tmp2%,tmp2/=;
for(i=cnt1-;i>=&&a[i]==b[i];--i);///遇到第一位不相等就退出,剩下的每一位填9
if(i>&&((n+1LL)%c[i]))ans=n-n%c[i]-;///前提是至少要在十位以上的某个位出现的数字不同即i>0,从那一位起剩下的位都填9,但还需要有一种特判情况,就是如果该数剩下的位已都是9,那么这时就不能再改变,因为要取最大,那么含尾数9最大的数就是n-n%a[i]-1。
cout<<ans<<endl;///否则输出原数字
}
return ;
}
K.这是一个沙雕题III
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int T;LL k,x,y,z;
int main(){
while(cin>>T){
while(T--){
cin>>k>>x>>y;///最多能用z张抵扣券
if((z=k/x)*x<=k&&k<=z*y)puts("Y");
else puts("N");
}
}
return ;
}
福建工程学院第七届ACM程序设计新生赛 (同步赛)的更多相关文章
- 湖南大学第十四届ACM程序设计新生杯(重现赛)I:II play with GG(博弈论||DP)
链接:https://ac.nowcoder.com/acm/contest/338/I 来源:牛客网 题目描述 IG won the S championship and many people a ...
- 河南省第七届ACM程序设计大赛赛后总结
我们学校ACM集训开始于4月5号(清明节),5月25日在郑州解放军信息工程大学举办,集训耗时50天,但是感觉效果还行,但是也不是太好:我们也已经尽力了,虽然说只拿了个银牌,每份收获的背后,都会有辛勤的 ...
- 湖南大学第十四届ACM程序设计新生杯(重现赛)G a+b+c+d=? (16进制与LL范围)
链接:https://ac.nowcoder.com/acm/contest/338/G来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K6 ...
- 湖南大学第十四届ACM程序设计新生杯(重现赛)
RANK 0 题数 0 期末复习没有参加,补几道喜欢的题. A: AFei Loves Magic 签到 思路 :不需考虑 碰撞 直接计算最终状态即可. #include<bits/stdc ...
- 河南省第七届ACM程序设计大赛总结
省赛总结 首先说说比赛时的情况吧,刚开始的时候我的任务就是翻译英文题目,找出比较水的题目,他们两个直接找中文水题切,其实每次比赛我们都是这样配合的,由于他们的判题系统一开始存在问题,交的正确的代码给判 ...
- 湖南大学第十四届ACM程序设计新生杯 E.Easy Problem
E.Easy Problem Description: Zghh likes number, but he doesn't like writing problem description. So h ...
- 湖南大学第十四届ACM程序设计新生杯 Dandan's lunch
Dandan's lunch Description: As everyone knows, there are now n people participating in the competiti ...
- ZZUOJ-1195-OS Job Scheduling(郑州大学第七届ACM大学生程序设计竞赛E题)
1195: OS Job Scheduling Time Limit: 2 Sec Memory Limit: 128 MB Submit: 106 Solved: 35 [id=1195&quo ...
- 山东省第七届ACM省赛------Memory Leak
Memory Leak Time Limit: 2000MS Memory limit: 131072K 题目描述 Memory Leak is a well-known kind of bug in ...
随机推荐
- android-測试so动态库(九)
1.依照androidproject向导一步步新建一个 2.将jar包放在libs文件夹下 3.在libs文件夹下新建armeabi文件夹.以及将so动态库放在该文件夹下 4.引用动态库,代码測试 p ...
- WM_GETMINMAXINFO的作用 .
如果想要实现窗口全屏,并且还有状态栏,会出现问题,那就是OnGetMinMaxInfo函数的作用.你可以试一下,如果把这个函数去掉,则当你按下工具栏中的全屏显示按钮时,框架视图确实变大了,但没有想象的 ...
- 2016/05/25 抽象类与API(接口)差别
简单来说, 接口是公开的,里面不能有私有的方法或变量,是用于让别人使用的,而抽象类是可以有私有方法或私有变量的, 另外,实现接口的一定要实现接口里定义的所有方法,而实现抽象类可以有选择地重写需要用到的 ...
- SpringCloud遇到的坑
1. 今天使用Feign 调用其他项目,结果一直跳转到断路器,跟踪发现是接口响应时间较长,解决方案 解决:# 在 Feign 模块中,单独设置这个超时时间不行,还要额外设置 Ribbon 的超时时间, ...
- amazon lightsail
https://51.ruyo.net/6038.html https://aws.amazon.com/cn/lightsail/
- MYSQL初级学习笔记九:MySQL索引的使用!(视频序号:初级_51)
知识点十一:索引的使用(51) 什么是索引: 索引的定义: 在关系型数据库中,索引是一种与表有关的数据库结构,它可以使对应于表的SQL语句执行的更快.索引的作用相当于图书的目录,可以 根据目录中的页码 ...
- poj 1094 Sorting It All Out 解题报告
题目链接:http://poj.org/problem?id=1094 题目意思:给出 n 个待排序的字母 和 m 种关系,问需要读到第 几 行可以确定这些字母的排列顺序或者有矛盾的地方,又或者虽然具 ...
- Oracle:imp导入imp-00000问题
现场环境:window2008 . oracle11.2g .客户端安装的是oracle10g一个简洁版 34M的. 在imp导入时,提示 Message 100 not found; No mes ...
- 安装程序工具 (Installutil.exe)
网址:https://msdn.microsoft.com/zh-cn/library/50614e95(VS.80).aspx 安装程序工具 (Installutil.exe) .NET Fram ...
- MFC之document与view实践总结
Document/View是MFC的基石,负责程序数据的管理和显示,Doculent和Viewd的关系有一档一视,一档多视和多档多视,下面将分别对实现过程中的重点知识进行总结. 1. 视图的同步更新 ...