Seq
Accepts: 1249 Submissions: 3956
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Problem Description
"Bears have a degree of recursive , are now given n, request A n- ."
Input
"A first line of input integer T, representative of T (1≤T≤100000) set of data. Continued T lines, each digit n-(1≤n≤10 12 is ^ {}) ."
Output
"Output T lines, each represents an integer answer."
Sample Input
5
1
2
3
4
5
Sample Output
1
1
0
3
0
Look larger data range, then guess whether regular, then print out the results of the recursive before 1000 when do question this question:
Seems to have found true law, then write the following code, submitted by.
code show as below:
//1005
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
long long t,n;
cin >> t;
while(t--){
cin >> n;
if(n%6 == 0)cout << n / 2<<endl;
if(n%6 == 1)cout << 1 + 4 * (n/6)<<endl;
if(n%6 == 2)cout << 1 + 3 * (n/6)<<endl;
if(n%6 == 3)cout << n / 6 <<endl;
if(n%6 == 4)cout << n - 1 <<endl;
if(n%6 == 5)cout << n / 6 <<endl;
}
return 0;
}