func_code_string: #include <bits/stdc++.h>   using namespace std;   int t, n, a[11];   int main() {     scanf( %d , &t);     while (t--) {       scanf( %d , &n);       int day = 0;       for (int i = 0; i < 7; i++) scanf( %d , a + i), day += a[i];       int week = (n - 1) / day, best = 7, left = n - week * day;       for (int i = 0; i < 7; i++) {         int tot = 0, cur = 7;         for (int j = 0; j < 7; j++)           if (a[j] && ++tot == left) {             cur = j;             break;           }         best = min(best, cur + 1);         rotate(a, a + 1, a + 7);       }       printf( %d n , week * 7 + best);     }   }   