UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#191649#3394. 走路UTAAAAAA1000ms1184kbC++962b2023-10-08 18:40:002023-10-08 22:00:53

answer

#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int xr = 0, f = 1;
	char cr;
	while (cr = getchar(), cr < '0' or cr > '9')
	{
		if (cr == '-')
		{
			f = -1;
		}
	}
	while (cr >= '0' and cr <= '9')
	{
		xr = (xr << 3) + (xr << 1) + (cr ^ 48);
		cr = getchar();
	}
	return xr * f;
}
long long n, x, y; 
signed main(){
    n = read();
    if(n == 1){
    	cout << "1 0";
    	return 0;
    }
    if(n == 3){
    	cout << "-2 2";
    	return 0;
    }
    if(n & 1){
    	if((n / 2 + 1) % 2 == 0)  printf("-%d ", n / 2 + 1);
    	else printf("%d ", n / 2 + 1);
    	if((n / 2) % 2 == 0)  cout<<"-"<<((n/2+1)/2)*2;
		else  cout<<((n/2+1)/2)*2;
    }else{
    	if((n / 2) % 2 == 0) printf("-%d ", n / 2);
    	else printf("%d ", n / 2);
    	if((n/2)%2==0) cout<<"-"<<((n/2+1)/2)*2;
    	else cout<<((n/2+1)/2)*2;
    }
    return 0;
}
/*
2 1.2
3 -2.2
4 -2.-2
5 3.-2
6 3.4
7 -4.4
8 -4.-4
9 5.-4

*/

Details

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

Test #1:

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

input:

3

output:

-2 2

result:

ok single line: '-2 2'

Test #2:

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

input:

14

output:

7 8

result:

ok single line: '7 8'

Test #3:

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

input:

29

output:

15 -14

result:

ok single line: '15 -14'

Test #4:

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

input:

44

output:

-22 -22

result:

ok single line: '-22 -22'

Test #5:

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

input:

512

output:

-256 -256

result:

ok single line: '-256 -256'

Test #6:

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

input:

931

output:

-466 466

result:

ok single line: '-466 466'

Test #7:

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

input:

777777

output:

388889 -388888

result:

ok single line: '388889 -388888'

Test #8:

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

input:

989898

output:

494949 494950

result:

ok single line: '494949 494950'

Test #9:

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

input:

132431

output:

-66216 66216

result:

ok single line: '-66216 66216'

Test #10:

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

input:

1998244353

output:

999122177 -999122176

result:

ok single line: '999122177 -999122176'

Extra Test:

score: 0
Extra Test Passed