Alice, a student of grade 66, is thinking about an Olympian Math problem, but she feels so despair that she cries. And her classmate, Bob, has no idea about the problem. Thus he wants you to help him. The problem is:
We denote :
We denote SS:
Then module is __
You are given an integer .
You have to calculate modulo .
Input
The first line contains an integer
, denoting the number of test cases.
For each test case, there is a line which has an integer .
It is guaranteed that .
Output
For each test case, print an integer
modulo
.
Hint
The first test is:
, and
modulo
is
.
The second test is: , and modulo is .
样例输入
2
2
3
样例输出
1
2
签到题一道,求出
然后再求模
,主要就是一个思维转换的问题,找出规律即可。
其中两点:
1:
简化后的结果就是
;
2:
取模
之后的结果为
.
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<ctime>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
int main(){
int n;
scanf("%d",&n);
while(n--){
LL k;
scanf("%lld",&k);
printf("%lld\n",k-1);
}
}