n번째 손님에서 n을 층 수인 h로 나눈 몫이 호수, 나머지가 층수
나머지를 먼저 구하고 100을 곱해서 층 수를 만든다.
몫을 구해서 호수를 더해준다. (호수가 1부터 시작하므로 +1 해줘야 함)
4. 나눠 떨어지는 경우는 따로 계산해 줘야 한다.
1) 층 수는 h와 같음
2) 호수는 n/h과 같음
정답 코드
#include <bits/stdc++.h>
using namespace std;
int t;
int h, w, n;
int ans;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>t;
while(t--) {
ans=0;
cin>>h>>w>>n;
if(n%h==0) {
ans+=h;
ans*=100;
ans+=(n/h);
}
else {
ans+=n%h;
ans*=100;
ans+=(n/h + 1);
}
cout<<ans<<'\n';
}
return 0;
}