poj 2304 Combination Lock

来源:互联网 发布:nginx 禁止ip段访问 编辑:程序博客网 时间:2024/06/07 01:01
//这题读懂题意就可以:题目是所锁上面的红色的那个刻度走过了的度数是多少?! #include <iostream>using namespace std;int main(){    int pos1, pos2, pos3, pos4, ans;    while (cin >> pos1 >> pos2 >> pos3 >> pos4)    {          if (pos1 == 0 &&  pos2 == 0 && pos3 == 0 && pos4 == 0) break;          ans = 0;          ans += 720;          ans += (pos1 - pos2 + 40) % 40 * 360 / 40;          ans += 360;          ans += (pos3 - pos2 + 40) % 40 * 360 / 40;          ans += (pos3 - pos4 + 40) % 40 * 360 / 40;          cout << ans << endl;    }        system("pause");}

原创粉丝点击