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. Direct3D 9 入门样例程序 圆锥体

    介绍 Directx3D 9 什么是DirectX,非常好说了,Win32 C++ API.主要是多媒体编程方面的,长处体如今高性能了,如今我知道的版本号最高是D3D11,可是我是学习入门的,从D3D ...

  2. Codeforces Round #420 (Div. 2) E. Okabe and El Psy Kongroo DP+矩阵快速幂加速

    E. Okabe and El Psy Kongroo     Okabe likes to take walks but knows that spies from the Organization ...

  3. Java程序员从笨鸟到菜鸟之(十五)Html基础积累总结(下)

     本文来自:曹胜欢博客专栏.转载请注明出处:http://blog.csdn.net/csh624366188 一:表格 1.表格的基本语法 <table>...</table> ...

  4. MySQL alter语句

    1:删除列 ALTER TABLE [表名字] DROP [列名称] 2:增加列 ALTER TABLE [表名字] ADD [列名称] INT NOT NULL  COMMENT '注释说明' 3: ...

  5. 成本函数计算方法J

    J = 1/(2*m) * sum((X*theta - y).^2);  OR

  6. ubuntu12.04配置NFS服务详解

    1:安装nfs sudo apt-get install nfs-kernel-server 2:配置服务 sudo vim /etc/exports 在末尾添加 /home/jyg *(rw,syn ...

  7. HDU1693 Eat the Trees —— 插头DP

    题目链接:https://vjudge.net/problem/HDU-1693 Eat the Trees Time Limit: 4000/2000 MS (Java/Others)    Mem ...

  8. LoadRunner使用动态链接库技术

    什么是动态库? 动态库一般又叫动态链接库英文为DLL,是Dynamic Link Library 的缩写形式,DLL是一个包含可由多个程序同时使用的代码和数据的库,DLL不是可执行文件.动态链接提供了 ...

  9. ping 中的“TTL"是什么意思

    简单来说就是表示一个数据包在网络中可以跳跃的结点数据,当该数据为零时本数据包将被抛弃 详细解释看以下引用: TTL (although named as "time" to liv ...

  10. python批量读取txt文件为DataFrame

    我们有时候会批量处理同一个文件夹下的文件,并且希望读取到一个文件里面便于我们计算操作.比方我有下图一系列的txt文件,我该如何把它们写入一个txt文件中并且读取为DataFrame格式呢? 首先我们要 ...