9.6训练日志
来源:互联网 发布:vb 获取div添加style 编辑:程序博客网 时间:2024/05/16 08:13
9.6训练日志
A - Arpa and a research in Mexican wave
Arpa is researching the Mexican wave.
There are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0.
At time 1, the first spectator stands.
At time 2, the second spectator stands.
…
At time k, the k-th spectator stands.
At time k + 1, the (k + 1)-th spectator stands and the first spectator sits.
At time k + 2, the (k + 2)-th spectator stands and the second spectator sits.
…
At time n, the n-th spectator stands and the (n - k)-th spectator sits.
At time n + 1, the (n + 1 - k)-th spectator sits.
…
At time n + k, the n-th spectator sits.
Arpa wants to know how many spectators are standing at time t.
代码分三类情况讨论一下即可`
#include<bits/stdc++.h>using namespace std;int main(){int n,k,t,i;cin>>n>>k>>t;if(t<=k) {cout<<t; }else if(t>k&&t<=n) {cout<<k; } else if(t>n){cout<<k+n-t; } }
B - Arpa and an exam about geometry
Arpa is taking a geometry exam. Here is the last problem of the exam.
You are given three points a, b, c.
Find a point and an angle such that if we rotate the page around the point by the angle, the new position of a is the same as the old position of b, and the new position of b is the same as the old position of c.
Arpa is doubting if the problem has a solution or not (i.e. if there exists a point and an angle satisfying the condition). Help Arpa determine if the question has a solution or not.
判断是否共线以及ab,bc距离是否相等即可
#include<bits/stdc++.h>using namespace std;long long int f(long long int a,long long int b,long long int c,long long int d) { return (c-a)*(c-a)+(d-b)*(d-b);}int main() { long long int ax,ay,bx,by,cx,cy; cin>>ax>>ay>>bx>>by>>cx>>cy; if(f(ax,ay,bx,by)==f(bx,by,cx,cy)&&(bx-ax)*(by-cy)!=(bx-cx)*(by-ay)) { cout<<"YES"; return 0; } cout<<"NO"; return 0;}
C - Five Dimensional Points
五维空间算角度,最多11个相邻,之后用公式套即可
#include<bits/stdc++.h>using namespace std;long long int m,a[120][6];int f(int x){long long int i,j,k,n,p;for(i=1;i<=m; i++) for(j=i+1;j<=m;j++) if(x!=i&&x!=j) {n=0;p=0; for(k=1;k<=5;k++) n+=(a[j][k]-a[x][k])*(a[i][k]-a[x][k]); if(n>0)return 0; } return 1; }int main() { long long int i,j,x,n,k,ans=0,b[120]={0};bool p=0; cin>>m; if(m>11) { cout<<0; return 0; } for(i=1;i<=m;i++) for(j=1;j<=5;j++) cin>>a[i][j]; for(x=1;x<=m;x++) { if(f(x)==1) {b[x]=1;ans++; } } cout<<ans<<endl; for(i=1;i<=m;i++) if(b[i]==1)cout<<i<<endl; }
D - Polycarpus’ Dice
Polycarp has n dice d1, d2, …, dn. The i-th dice shows numbers from 1 to di. Polycarp rolled all the dice and the sum of numbers they showed is A. Agrippina didn’t see which dice showed what number, she knows only the sum A and the values d1, d2, …, dn. However, she finds it enough to make a series of statements of the following type: dice i couldn’t show number r. For example, if Polycarp had two six-faced dice and the total sum is A = 11, then Agrippina can state that each of the two dice couldn’t show a value less than five (otherwise, the remaining dice must have a value of at least seven, which is impossible).
For each dice find the number of values for which it can be guaranteed that the dice couldn’t show these values if the sum of the shown values is A.
每一次判断可取种数,是否加上剩余数的和大于所求数,是否小于所求数减去剩余数数量
#include<bits/stdc++.h>using namespace std;const int N=200009;int main() { long long int A=0,p,x,n,i,a[N],ans=0; cin>>n>>A; for(i=1; i<=n; i++) { cin>>a[i]; ans+=a[i]; } if(n==1) cout<<a[1]-1; else for(i=1; i<=n; i++) { x=0; p=ans-a[i]; p=A-p; if(p>1)x=p-1; if(a[i]+n-1>A) x=x-A+a[i]+n-1; if(a[i]-1<=x) cout<<a[i]-1<<" "; else cout<<x<<" "; }}
- 9.6训练日志
- 健身训练日志
- caffe训练日志可视化
- 9.4训练日志
- 9.5训练日志
- 9.7训练日志
- 9.8训练日志
- 9.9训练日志
- caffe:如何保存训练日志?
- 【转】caffe训练日志输出
- 如何保存Caffe训练日志
- caffe下保存训练数据的训练日志
- Caffe中Mnist的训练日志解读
- caffe学习(3)------caffe训练日志
- MATLAB绘制caffe训练日志曲线
- Caffe中Mnist的训练日志解读
- Caffe-Miscoroft无训练日志解决方法
- <caffe学习笔记> caffe训练日志输出
- 最短路径问题 POJ 3268
- 暑期项目实训之健康宝APP(五)
- public继承
- SPOJ
- react的安装和环境配置
- 9.6训练日志
- spring整合mybatis
- log4j-over-slf4j与slf4j-log4j12共存stack overflow异常分析
- sql之left join、right join、inner join的区别
- Redis常用数据类型
- 生产者和消费者问题详解
- 【Angular】windows10下配置Angular开发环境
- 简单的鼠标移出移入样式改变
- 6.策略模式