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程序设计新生赛 (同步赛)的更多相关文章

  1. 湖南大学第十四届ACM程序设计新生杯(重现赛)I:II play with GG(博弈论||DP)

    链接:https://ac.nowcoder.com/acm/contest/338/I 来源:牛客网 题目描述 IG won the S championship and many people a ...

  2. 河南省第七届ACM程序设计大赛赛后总结

    我们学校ACM集训开始于4月5号(清明节),5月25日在郑州解放军信息工程大学举办,集训耗时50天,但是感觉效果还行,但是也不是太好:我们也已经尽力了,虽然说只拿了个银牌,每份收获的背后,都会有辛勤的 ...

  3. 湖南大学第十四届ACM程序设计新生杯(重现赛)G a+b+c+d=? (16进制与LL范围)

    链接:https://ac.nowcoder.com/acm/contest/338/G来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K6 ...

  4. 湖南大学第十四届ACM程序设计新生杯(重现赛)

    RANK  0 题数 0 期末复习没有参加,补几道喜欢的题. A: AFei Loves Magic  签到 思路 :不需考虑 碰撞 直接计算最终状态即可. #include<bits/stdc ...

  5. 河南省第七届ACM程序设计大赛总结

    省赛总结 首先说说比赛时的情况吧,刚开始的时候我的任务就是翻译英文题目,找出比较水的题目,他们两个直接找中文水题切,其实每次比赛我们都是这样配合的,由于他们的判题系统一开始存在问题,交的正确的代码给判 ...

  6. 湖南大学第十四届ACM程序设计新生杯 E.Easy Problem

    E.Easy Problem Description: Zghh likes number, but he doesn't like writing problem description. So h ...

  7. 湖南大学第十四届ACM程序设计新生杯 Dandan's lunch

    Dandan's lunch Description: As everyone knows, there are now n people participating in the competiti ...

  8. 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 ...

  9. 山东省第七届ACM省赛------Memory Leak

    Memory Leak Time Limit: 2000MS Memory limit: 131072K 题目描述 Memory Leak is a well-known kind of bug in ...

随机推荐

  1. adb问题整理

    1.开启了两个adb,关掉一个,重启eclipse既可 java.io.IOException: 您的主机中的软件中止了一个已建立的连接. at sun.nio.ch.SocketDispatcher ...

  2. Python 002- 爬虫爬取淘宝上耳机的信息

    参照:https://mp.weixin.qq.com/s/gwzym3Za-qQAiEnVP2eYjQ 一般看源码就可以解决问题啦 #-*- coding:utf-8 -*- import re i ...

  3. configuration类详解

    hadoop中,组件配置是由Hadoop的Configuration的一个实例实现.(在源码包的org.apache.hadoop.conf中可以找到)先上个类图:这只是部分的,Configuraat ...

  4. dubbo配置指南

    dubbo配置指南 SLA配置在此完成!Service Layer Agreement ApplicationConfig 应用配置,用于配置当前应用信息,不管该应用是提供者还是消费者. Regist ...

  5. Spark简单集群搭建

    1. 上传spark-2.2.0-bin-hadoop2.7.tgz安装包到/home/dtouding目录下 2. 解压安装包到/bigdata/目录下,tar –zxvf spark-2.2.0- ...

  6. C# delegate Action<T> lambda表达式

    转载以记录:http://blog.csdn.net/educast/article/details/7219854 在使用 Action<T> 委托时,不必显式定义一个封装只有一个参数的 ...

  7. thinkphp 防sql注入

    $Model->where("id=%d and username='%s' and xx='%f'",array($id,$username,$xx))->selec ...

  8. XMU C语言程序设计实践(5)

    •       使用动态链表完成一个简单的商品库存信息管理系统. •       商品信息包括如下字段:商品号.商品名称.商品库存 •       函数 create:接收用户输入的商品号和商品名称的 ...

  9. eureka-注册中心使用密码验证

    spring cloud 1.1 版本之后可以使用 配置文件: bootstrap.yml server.port: 9000 spring.application.name: registry eu ...

  10. POJ3104 Drying —— 二分

    题目链接:http://poj.org/problem?id=3104 Drying Time Limit: 2000MS   Memory Limit: 65536K Total Submissio ...