此題感覺很簡單,但是請你一定要想一想,如果你順時針轉數字鎖的時候,數字卻是會逆時針轉動的!= = 我被這個騙了三次……
P.S. 不過這次我沒被騙^^b
C++(0.008)
/*******************************************************/
/* UVa 10550 Combination Lock */
/* Author: Maplewing [at] knightzone.studio */
/* Version: 2011/12/17 */
/*******************************************************/
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int num[4], angle;
while( scanf( "%d%d%d%d",
&num[0],
&num[1],
&num[2],
&num[3] ) != EOF ){
if( !num[0] && !num[1] && !num[2] && !num[3] )
break;
angle = 1080;
angle += ((num[0]-num[1])+40)%40*9;
angle += ((num[2]-num[1])+40)%40*9;
angle += ((num[2]-num[3])+40)%40*9;
printf( "%d\n", angle );
}
return 0;
}