Advertisement
skb50bd

UVa 11805 Bafana Bafana

Aug 28th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int T, N, K, P, i, L;
  6.     cin >> T;
  7.     for(i = 1; i <= T; i++) {
  8.         cin >> N >> K >> P;
  9.         L = (K + P <= N) ? K + P : (K + P) % N;
  10.         L = (!L) ? N : L;
  11.         cout << "Case " << i << ": " << L << endl;
  12.     }
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement