UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#191788#3394. 走路Xepcs1000ms1224kbC++11967b2023-10-08 19:00:072023-10-08 22:11:53

answer

#include<bits/stdc++.h>
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define DU double
#define rep(i,x,n) for(int i=(x);i<=(n);i++)
#define nep(i,x,n) for(int i=(x);i>=(n);i--)
using namespace std;
inline ll read(){
	ll s=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		s=(s<<3)+(s<<1)+(ch^48);
		ch=getchar();
	}
	return s*f;
}
inline void print(ll x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	if(x>9) print(x/10);
	putchar(x%10+'0');
}
inline void Solve(){
	ll n=read(),x,y;
	if(n%4==1) x=-2*(n/4)+n,y=-2*(n/4);
	if(n%4==2) x=-2*(n/4)+n-1,y=-2*(n/4)+n;
	if(n%4==3) x=-2*(n/4+1),y=-2*(n/4)+n-1;
	if(n%4==0) x=-2*(n/4),y=-2*(n/4);
	printf("%lld %lld\n",x,y);
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int Tests=1;
	while(Tests--) Solve();
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1220kb

input:

3

output:

-2 2

result:

ok single line: '-2 2'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1224kb

input:

14

output:

7 8

result:

ok single line: '7 8'

Test #3:

score: 10
Accepted
time: 0ms
memory: 1220kb

input:

29

output:

15 -14

result:

ok single line: '15 -14'

Test #4:

score: 10
Accepted
time: 0ms
memory: 1220kb

input:

44

output:

-22 -22

result:

ok single line: '-22 -22'

Test #5:

score: 10
Accepted
time: 0ms
memory: 1220kb

input:

512

output:

-256 -256

result:

ok single line: '-256 -256'

Test #6:

score: 10
Accepted
time: 0ms
memory: 1220kb

input:

931

output:

-466 466

result:

ok single line: '-466 466'

Test #7:

score: 10
Accepted
time: 0ms
memory: 1224kb

input:

777777

output:

388889 -388888

result:

ok single line: '388889 -388888'

Test #8:

score: 10
Accepted
time: 0ms
memory: 1220kb

input:

989898

output:

494949 494950

result:

ok single line: '494949 494950'

Test #9:

score: 10
Accepted
time: 0ms
memory: 1220kb

input:

132431

output:

-66216 66216

result:

ok single line: '-66216 66216'

Test #10:

score: 10
Accepted
time: 0ms
memory: 1220kb

input:

1998244353

output:

999122177 -999122176

result:

ok single line: '999122177 -999122176'

Extra Test:

score: 0
Extra Test Passed