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. c++学习笔记之基础---类内声明函数后在类外定义的一种方法

    在C++的“类”中经常遇到这样的函数, 返回值类型名 类名::函数成员名(参数表){ 函数体.} 双冒号的作用 ::域名解析符!返回值类型名 类名::函数成员名(参数表) { 函数体. } 这个是在类 ...

  2. ios如何获取手机的网络状态和运营商名称

    本文转载至 http://blog.csdn.net/justinjing0612/article/details/38313747 以前获取手机的网络状态和运营商名称都是似有API, 现在我们可以大 ...

  3. sanic官方文档解析之路由

    1,路由,路由相当于一个网址的地址,来确定网址的位置和唯一性 当http://server.url/被允许访问服务器,当最后的"/"通过路由匹配到了业务逻辑处理的函数,将会返回一个 ...

  4. js编程精解--笔记

    看这本书的目的是为了更好的使用mongodb,所以只看js编程语言基础,不看浏览器和画布. 需要看1-11章,共160页 第一章 值.类型和运算符 第二章 程序结构 第三章 函数 第四章 数据结构:对 ...

  5. Java DES加密解密

    import javax.crypto.Cipher; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpe ...

  6. Linux系统中的运行级别

    什么是运行级呢?简单的说,运行级就是操作系统当前正在运行的功能级别. 它让一些程序在一个级别启动,而另外一个级别的时候不启动. Linux系统的有效登录模式有0~9共十种,不过沿用UNIX系统的至多6 ...

  7. hdu2544 迪杰斯特拉题目优化

    点击打开题目链接 迪杰斯特拉的用法不多讲,详见  点击打开链接 . 下面两个代码: 这个是用邻接矩阵存图的迪杰斯特拉. #include<stdio.h> int main() { int ...

  8. codeforces 691F F. Couple Cover(组合计数)

    题目链接: F. Couple Cover time limit per test 3 seconds memory limit per test 512 megabytes input standa ...

  9. 二维码解码器Zbar+VS2012开发环境配置

    Zbar条码解码器是一个开源的二维码(包括条形码)解码器,可以识别来至于视频流,图像文件.手持扫码器和视频设备(如摄像头)等二维码识别,支持EAN-13/UPC-A, UPC-E, EAN-8, Co ...

  10. kali-linux简单学习

    一. curl --head 返回操作系统的版本 同样的Xprobe2可以和nmap一起返回操作系统的版本 nmap 直接加域名或者ip地址,比较权威判断操作系统版本,或者服务版本,以及开的端口 nm ...