mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
18 lines
325 B
C++
18 lines
325 B
C++
|
#include<iostream>
|
||
|
using namespace std;
|
||
|
int main()
|
||
|
{
|
||
|
long T,yu;
|
||
|
long feng;
|
||
|
while(cin>>T&&T)
|
||
|
{
|
||
|
yu=T%4018;
|
||
|
if(yu%2==0)
|
||
|
feng=((((yu*yu)/4)%2009)*((2*yu+3)%2009));
|
||
|
else
|
||
|
feng=((((yu+1)*(yu+1)/4)%2009)*((2*yu-1)%2009));
|
||
|
printf("%ld\n",feng%2009);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|