“Sometimes it is the people no one can imagine anything of who do the things no one can imagine.” ― Sir Alan Turing


ADS

ADS

Sunday, April 9, 2017

UVa 11805 Bafana Bafana Solution in C / C++



Source Code 

#include<stdio.h>

int main() {
  int n, k, p, a, ans, i, j;
  while (scanf("%d", & a) == 1) {
    for (j = 1; j <= a; j++) {
      scanf("%d%d%d", & n, & k, & p);
      ans = k + p;
      while (ans > n) {
        ans = ans - n;
      }
      printf("Case %d: %d\n", j, ans);
    }
  }
  return 0;
}

No comments:

Post a Comment