You need to use long long to handle the day because it is out of range of 
32-bit integers.


-------------


*#include <iostream>*
*#include <vector>*
*#include <algorithm>*
*using namespace std;*

*long long calcTime();*
*vector<long long> readVector(int n);*

*int main() {*
* int nCases = 0;*
* cin >> nCases;*

* for (int i = 0; i < nCases; i++) {*
* long long maxDay = calcTime();*
* cout << "Case #" << i + 1 << ": " << maxDay << endl;*
* }*

*}*

*long long calcTime() {*
* int n = 0;*
* long long d = 0;*
* cin >> n;*
* cin >> d;*
* vector<long long> routes = readVector(n);*
* long long currDay = d;*

* for (int i = n - 1; 0 <= i; i--) {*
* currDay -= currDay % routes[i];*
* }*
* return currDay;*
*}*

*vector<long long> readVector(int n) {*
* vector<long long> rtnV;*
* for (int i = 0; i < n; i++) {*
* long long temp = 0;*
* cin >> temp;*
* rtnV.push_back(temp);*
* }*
* return rtnV;*
*}*

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/d03b785e-71c1-4fc7-abc3-4f10d3686278%40googlegroups.com.

Reply via email to