package com.fqyuan.meituan; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int x1 = scanner.nextInt(); int x2 = scanner.nextInt(); System.out.println(how2Rotate(x1, x2)); } public static String passTest(int[] input) { String result = "No"; int sum = input[0]; int maxVal = input[0]; for (int i = 1; i < input.length; i++) { sum += input[i]; if (input[i] > maxVal) maxVal = input[i]; } if (maxVal * 2 > sum) result = "No"; else result = "YES"; return result; } public static int how2Rotate(int x1, int x2) { int result = 0; if (x1 > x2) { if (x1 - x2 > 180) result = 360 - x1 + x2; else result = -1 * (x1 - x2); } else { if (x2 - x1 > 180) result = -1 * (360 - x2 + x1); else result = x2 - x1; } return result; } }
点赞 3

相关推荐

酷酷的喜马拉雅山:感觉这比一直在初筛不动的好多了
点赞 评论 收藏
分享
在看牛客的社畜很积极:身高体重那一行信息去掉,学校那一行的信息放上面,找半天都没找到你是哪个学校什么专业的
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务