A,B太水了就不写了- -
感觉思路都挺清楚的,不多解释了
C.转啊转
Time Limit: 1000 MS | Memory Limit: 65536 KB |
Total Submissions: 7 | Accepted: 2 |
Description
动点初始时刻在圆的三点钟方向(即与x轴正方向平行),并以逆时针方向绕圆转。
Input
先输入一个整数T,表示T(T<50)组数据。
每组数据一行七个实数a,b,r(r>0),x,y,w(w>=0),t(t>=0) 分别表示圆的圆心坐标(a,b),半径r,固定点坐标(x,y),角速度w,要查询的时刻t。
上述所有数据的绝对值小于10000。
Output
输出答案占一行,保留2位小数。
Sample Input
1 1 1 3 1 3 0
Sample Output
Hint
角速度定义:
一个以弧度为单位的圆(一个圆周为2π,即:360度=2π),在单位时间内所走的弧度即为角速度。
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
const double pi = acos(-1.0);
///
///
int main(int argc, char**argv) {
//ios_base::sync_with_stdio(0); cin.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int T;
cin>>T;
while(T--){
double a,b,r;
cin>>a>>b>>r;
double xa,ya;
cin>>xa>>ya;
double w,t;
cin>>w>>t;
double xb=a+r*cos(w*t);
double yb=b+r*sin(w*t);
//cout<<abs((b-ya)*(xa-xb)-(ya-yb)*(a-xa))<<endl;
//cout<<(sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)))<<endl;
double d=abs((b-ya)*(xa-xb)-(ya-yb)*(a-xa))/(sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)));
double ans=2*(sqrt(r*r-d*d));
//cout<<xb<<" "<<yb<<endl;
printf("%.2f\n",ans);
}
//system("pause");
return 0;
}
//END
D.梯田AGAIN
Time Limit: 1000 MS | Memory Limit: 65536 KB |
Total Submissions: 1 | Accepted: 1 |
Description
奴隶们去年尝试了一下,结果发现,由于土质太过松软,水能够透过土地渗入到相邻的梯田,即对于海啸高度h,梯田中所有小于等于h的土地都会由于土质松软而被被淹没。
现在给你一个n*m的矩阵,代表梯田中每块田地的高度。然后给定q个询问,每个询问给定一个海啸高度h,问在此高度下,不被淹没的梯田数量是多少。
Input
对于每组测试数据:
第一行三个数字n,m,q,表示梯田的行数,列数和询问数。
之后n行,每行m个数字,表示每块田地的高度,梯田高度不大于1000000。
之后q行,每行给出一个海啸高度h,问大于这个高度的梯田有多少块。
0<T<20。
0<n,m<=200。
0<=q<1000。
0<=h<=1000000.
Output
Sample Input
2 2 2
1 2
3 4
2
3
2 3 3
1 2 3
3 4 5
0
4
5
Sample Output
1
6
1
0
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
const double pi = acos(-1.0);
///
///
int main(int argc, char**argv) {
ios_base::sync_with_stdio(0); cin.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int T;
cin>>T;
while(T--){
int m,n,q;
cin>>n;
cin>>m;
cin>>q;
int st[40010];
for(int i=1;i<=m*n;i++){
cin>>st[i];
}
sort(st+1,st+1+m*n);
while(q--){
int L;
cin>>L;
int h=upper_bound(st+1,st+1+m*n,L)-(st+1);
cout<<m*n-h<<"\n";
}
}
//system("pause");
return 0;
}
//END
E.箭无虚发
Time Limit: 1000 MS | Memory Limit: 65536 KB |
Total Submissions: 2 | Accepted: 1 |
Description
对于每发一次箭,YZ给他4种成绩(优、良、中、差),JH有三种拉弓以及瞄准时间a ,b,c(a>=b>=c)分别能拿优,良,中等级,如果不拉弓不瞄(直接射),只能拿差(不能中靶)了。
现在JH想知道,在保证自己弹无虚发(不获得差)的情况下,最多能拿多少个优。
如果JH不能做到弹无虚发,输出Oh,my god!
Input
对于每组数据,第一行为一个整数n,表示总共有n支箭。
(0<n<=1000)
之后n行,每行包含三个数字a,b,c,分别表示拿对应等级所需要花的时间。
(0<c<=b<=a<=1000)
之后一个数字t,表示JH有考核总时间为t
(0<=t<=1e6)
Output
Sample Input
1
3 2 1
1
2
3 2 1
3 2 1
4
2
3 2 1
3 2 1
1
Sample Output
1
Oh,my god!
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
const double pi = acos(-1.0);
///
///
int main(int argc, char**argv) {
ios_base::sync_with_stdio(0); cin.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int T;
cin>>T;
while(T--){
int n;
cin>>n;
int a[1010],b[1010],c[1010];
for(int i=1;i<=n;i++){
cin>>a[i]>>b[i]>>c[i];
a[i]=a[i]-c[i];
}
int t;
cin>>t;
sort(a+1,a+1+n);
//sort(b+1,b+1+n);
sort(c+1,c+1+n);
int tc=t;
for(int i=1;i<=n;i++){
tc-=c[i];
}
int num_a=0;
int ta=tc;
for(int i=1;i<=n;i++){
ta-=a[i];
if(ta<0) break;
num_a++;
}
int cnt=0;
if(tc<0){
cout<<"Oh,my god!\n";
}
else{
cout<<num_a<<"\n";
}
}
//system("pause");
return 0;
}
//END