#include <iostream> #include <vector> using namespace std; int main() { int testcase; cin >> testcase; while(testcase--) { int W,H; cin >> H >> W; int N; cin >> N; int cnt = 0; int i,j; bool BreakPoint = false; for(i = 1; i <= W; i++) { for(j = 1; j <= H; j++) { if(++cnt == N) BreakPoint = true; if(BreakPoint) break; } if(BreakPoint) break; } if(i < 10) cout << j << "0" << i << endl; else cout << j << i << endl; } }
# include < iostream > # include < vector > using namespace std ; int Num_of_Divisor ( int n ) { int Count = 0 ; for ( int i = 1 ; i < = n ; i + + ) if ( n % i = = 0 ) Count + + ; return Count ; } int main ( ) { int Testcase ; cin > > Testcase ; while ( Testcase - - ) { int Rooms ; cin > > Rooms ; vector < int > Prisons ; for ( int i = 0 ; i < Rooms ; i + + ) Prisons . push_back ( 0 ) ; for ( int i = 1 ; i < Prisons . size ( ) + 1 ; i + + ) { if ( ( Num_of_Divisor ( i ) % 2 ) = = 0 ) Prisons [ i - 1 ] = 0 ; else Prisons [ i - 1 ] = 1 ; } int Fleer = 0 ; for ( int i = 0 ; i < Prisons . size ( ) ; i + + ) if ( Prisons ...
댓글
댓글 쓰기