牛客练习赛69-时间复杂度

时间复杂度

https://ac.nowcoder.com/acm/contest/7329/A

简简单单的一道题
算出各自走过的角度之后取余360度。
然后将两个角比较一下选出最小的即可
一个角度为   转的角度大的  -   转的角度小的
另个角度为   360-转的角度大的 + 转的角度小的
最后四舍五入即可
import java.math.*;
import java.util.*;
public class Main {
    public static void main(String args[])
    {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        while(n-->0)
        {
            double t = input.nextDouble();
            double fen = (t*6)%360,shi = (t*0.5)%360;
            System.out.println(Math.round(Math.min(Math.max(fen,shi)-Math.min(fen,shi),360-(Math.max(fen,shi)-Math.min(fen,shi)))));
        }
    }
                  }



全部评论

相关推荐

09-23 15:37
门头沟学院 Java
真的很糟糕:新的卡简历方式
我的秋招日记
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务