UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#191363#3394. 走路stonesx1001ms1192kbC++11546b2023-10-08 18:11:522023-10-08 21:37:13

answer

#include <bits/stdc++.h>
using namespace std;
long long n, x, y, lst[4], d[4];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
#endif
	scanf("%lld", &n);
	for (int i = 0; i < 4; i++)
		lst[n % 4] = n, n--;
	n += 4;
	for (int i = 0; i < 4; i++)
		d[i] = (lst[i] - (i ? i : 4) >> 2LL) + 1LL;
	x = (1 + lst[1]) * d[1] >> 1LL;
	x -= (3 + lst[3]) * d[3] >> 1LL;
	y = (2 + lst[2]) * d[2] >> 1LL;
	y -= (4 + lst[0]) * d[0] >> 1LL;
	printf("%lld %lld\n", x, y);
	return 0;
}

详细

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

Test #1:

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

input:

3

output:

-2 2

result:

ok single line: '-2 2'

Test #2:

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

input:

14

output:

7 8

result:

ok single line: '7 8'

Test #3:

score: 10
Accepted
time: 1ms
memory: 1192kb

input:

29

output:

15 -14

result:

ok single line: '15 -14'

Test #4:

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

input:

44

output:

-22 -22

result:

ok single line: '-22 -22'

Test #5:

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

input:

512

output:

-256 -256

result:

ok single line: '-256 -256'

Test #6:

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

input:

931

output:

-466 466

result:

ok single line: '-466 466'

Test #7:

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

input:

777777

output:

388889 -388888

result:

ok single line: '388889 -388888'

Test #8:

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

input:

989898

output:

494949 494950

result:

ok single line: '494949 494950'

Test #9:

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

input:

132431

output:

-66216 66216

result:

ok single line: '-66216 66216'

Test #10:

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

input:

1998244353

output:

999122177 -999122176

result:

ok single line: '999122177 -999122176'

Extra Test:

score: 0
Extra Test Passed