CodeForces

Mister B and Book ReadingCodeForces - 820A 

题意:C,V0,V1,A,L。.总共有C页书,第一天以V0速度读,每天加A,但是不能超过V1,并且要从前一天的看到的当前页数的前L页开始读

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int c,v0,v1,a,l,ans;
int main(){
    scanf("%d%d%d%d%d",&c,&v0,&v1,&a,&l);
    while(c>0){
        ans++;
        if(ans!=1)c+=l;
        c-=v0;
        v0=min(v0+a,v1);
    }
    printf("%d",ans);
    return 0;
}
AC 模拟

Mister B and Angle in Polygon CodeForces - 820B 

在正n多边形内选三个点组成一个角,求最靠近t的这个角的大小三个点号码

/*
    算出多边形能分出的最小角,得出角度a需要num个角,固定1,2,第三个点为num+2。
    细节:1.多边形边数大,计算最小角用double。
           2.考虑角小于最小角,角大于最大角。
*/
#include <iostream>  
using namespace std;  
double n,a; 
int main(){  
    while(cin>>n>>a){  
        double ss=(double)(180-360/(double)n)/(n-2);
        int num=(int)a/ss;  
        if(!num) num++;  
        else if((a-ss*num)>(ss*(num+1)-a))num++;  
        if(num+2>n)num=n-2;  
        cout<<2<<" "<<1<<" "<<num+2<<endl;  
    }  
} 
AC 计算几何
原文地址:https://www.cnblogs.com/thmyl/p/7468979.html