提出 #372107


ソースコード 拡げる

#include <string>
#include <vector>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <sstream>
#include <algorithm>

using namespace std;
#define EPS 1e-06

int main() {
	double x, y; cin >> x >> y;

	// remove minus number
	int minus_diff = 2000;
	x += minus_diff;
	y += minus_diff;

	int x1000, y1000;

	x1000 = int(x * 1000 + EPS);
	y1000 = int(y * 1000 + EPS);

	int dx = x1000 / 1000;
	int dy = y1000 / 1000;
	int sx = x1000 % 1000;
	int sy = y1000 % 1000;

	// calc without dx, dy
	pair<pair<int, int>, pair<int, int> > ans1, ans2;

	// escape same line
	if (sx == 0) {
		sx += 1000;
		dx -= 1;
	}
	ans1.first = make_pair(0, 0);
	ans1.second = make_pair(sx, sy);

	ans2.first = make_pair(0, 1);
	ans2.second = make_pair(sx, sy - 999);

  // plus dx, dy
	ans1.first.first += dx;
	ans1.second.first += dx;
	ans1.first.second += dy;
	ans1.second.second += dy;

	ans2.first.first += dx;
	ans2.second.first += dx;
	ans2.first.second += dy;
	ans2.second.second += dy;

	// reverse minus
	ans1.first.first -= minus_diff;
	ans1.second.first -= minus_diff;
	ans1.first.second -= minus_diff;
	ans1.second.second -= minus_diff;

	ans2.first.first -= minus_diff;
	ans2.second.first -= minus_diff;
	ans2.first.second -= minus_diff;
	ans2.second.second -= minus_diff;

	cout << ans1.first.first << " " << ans1.first.second << " " << ans1.second.first << " " << ans1.second.second << endl;
	cout << ans2.first.first << " " << ans2.first.second << " " << ans2.second.first << " " << ans2.second.second << endl;
	
	return 0;
}

提出情報

提出日時
問題 B - 交点
ユーザ greentea
言語 C++ (GCC 4.9.2)
得点 100
コード長 1603 Byte
結果 AC
実行時間 28 ms
メモリ 928 KiB

ジャッジ結果

セット名 All
得点 / 配点 100 / 100
結果
AC × 27
セット名 テストケース
All scrambled_00.txt, scrambled_01.txt, scrambled_02.txt, scrambled_03.txt, scrambled_04.txt, scrambled_05.txt, scrambled_06.txt, scrambled_07.txt, scrambled_08.txt, scrambled_09.txt, scrambled_10.txt, scrambled_11.txt, scrambled_12.txt, scrambled_13.txt, scrambled_14.txt, scrambled_15.txt, scrambled_16.txt, scrambled_17.txt, scrambled_18.txt, scrambled_19.txt, scrambled_20.txt, scrambled_21.txt, scrambled_22.txt, scrambled_23.txt, scrambled_24.txt, scrambled_25.txt, scrambled_26.txt
ケース名 結果 実行時間 メモリ
scrambled_00.txt AC 25 ms 920 KiB
scrambled_01.txt AC 23 ms 788 KiB
scrambled_02.txt AC 23 ms 808 KiB
scrambled_03.txt AC 22 ms 676 KiB
scrambled_04.txt AC 22 ms 792 KiB
scrambled_05.txt AC 23 ms 924 KiB
scrambled_06.txt AC 22 ms 800 KiB
scrambled_07.txt AC 24 ms 792 KiB
scrambled_08.txt AC 24 ms 920 KiB
scrambled_09.txt AC 25 ms 916 KiB
scrambled_10.txt AC 23 ms 924 KiB
scrambled_11.txt AC 28 ms 924 KiB
scrambled_12.txt AC 26 ms 756 KiB
scrambled_13.txt AC 24 ms 928 KiB
scrambled_14.txt AC 23 ms 796 KiB
scrambled_15.txt AC 27 ms 768 KiB
scrambled_16.txt AC 22 ms 928 KiB
scrambled_17.txt AC 24 ms 792 KiB
scrambled_18.txt AC 26 ms 764 KiB
scrambled_19.txt AC 23 ms 928 KiB
scrambled_20.txt AC 26 ms 792 KiB
scrambled_21.txt AC 24 ms 920 KiB
scrambled_22.txt AC 24 ms 924 KiB
scrambled_23.txt AC 25 ms 924 KiB
scrambled_24.txt AC 24 ms 928 KiB
scrambled_25.txt AC 25 ms 924 KiB
scrambled_26.txt AC 23 ms 800 KiB