D. D 镜面反射 刘振宇

    Type: Default 1000ms 256MiB

D 镜面反射 刘振宇

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

#include <iostream>
using namespace std ;

#define int long long
inline int read ( ) {
	char ch = getchar ( ) ;
	int x = 0 ;
	while ( ch < '0' || ch > '9' )
		ch = getchar ( ) ;
	while ( ch >= '0' && ch <= '9' )
		x = x * 10 + ch - 48 , ch = getchar ( ) ;
	return x ;
}

int gcd ( int a , int b ) {
	if ( ! a ) return b ;
	while ( a ^= b ^= a ^= b %= a ) ;
	return b ;
}

signed main ( ) {
	int T ;
	cin >> T ;
	while ( T -- ) {
		int p = read ( ) , q = read ( ) * 180ll ;
		int pq = gcd ( p , q ) ;
		cout << q / pq - 2 << "\n" ;
	}
	return 0 ;
}

7.31日竞赛3班造数据

Not Attended
Status
Done
Rule
IOI
Problem
8
Start at
2025-7-31 18:00
End at
2025-7-31 21:00
Duration
3 hour(s)
Host
Partic.
8