Submission #372958
Source Code Expand
#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<utility>
#include<complex>
using namespace std;
#define reE(i,a,b) for(auto (i)=(a);(i)<=(b);(i)++)
#define rE(i,b) reE(i,0,b)
#define reT(i,a,b) for(auto (i)=(a);(i)<(b);(i)++)
#define rT(i,b) reT(i,0,b)
#define rep(i,a,b) reE(i,a,b);
#define rev(i,a,b) for(auto (i)=(b)-1;(i)>=(a);(i)--)
#define fe(i,b) for (auto &(i):b);
#define itr(i,b) for(auto (i)=(b).begin();(i)!=(b).end();++(i))
#define rti(i,b) for(auto (i)=(b).rbegin();(i)!=(b).rend();++(i))
#define LL long long
#define all(b) (b).begin(),(b).end()
#define input_init stringstream ss; string strtoken, token; istringstream is
#define input_line getline(cin, strtoken);is.str(strtoken);is.clear(istringstream::goodbit)
#define input_token(num) ss.str(""); ss.clear(stringstream::goodbit); getline(is, token, ','); ss << token; ss >> num
#define dir(xx,yy,x,y,i) (xx)=(x)+dir[(i)],(yy)=(y)+dir[(i)+1]
typedef complex<double> P;
typedef vector<P> Poly;
const LL INF = 1 << 30;
const double eps = 1e-8;
const int dir[] = { 0, 1, 0, -1, 0 };
struct NUM{
int up=0, down=0;
int pm = 1;
};
NUM x, y;
#define W_pair(xx,xy,yx,yy) make_pair(make_pair((xx),(xy)),make_pair((yx),(yy)))
vector<pair<pair<int, int>, pair<int, int>>> ans;
void calc(){
int rev_x = 1000 - x.down;
int rev_y = 1000 - y.down;
ans.push_back(W_pair(x.up + 1, y.up + 1, x.up + 1 + rev_x, y.up + 1 + rev_y));
ans.push_back(W_pair(x.up + 1, y.up, x.up + 1 + rev_x, y.up - y.down));
}
int main(void){
int w=0,h = 0;
string X, Y;
cin >> X >> Y;
int i;
for (i = 0; i < (int)X.size();i++){
w++;
if (X[i] == '-')x.pm = -1;
else if (X[i] == '.')break;
else {x.up *= 10;x.up += X[i]-'0';
}
}
for (i = 0; i < (int)Y.size(); i++){
h++;
if (Y[i] == '-')y.pm = -1;
else if (Y[i] == '.')break;
else {
y.up *= 10; y.up += Y[i] - '0';
}
}
for (i = w; i < (int)X.size(); i++){
x.down *= 10; x.down += X[i] - '0';
}
for (i = h; i < (int)Y.size(); i++){
y.down *= 10; y.down += Y[i] - '0';
}
calc();
for(i=0;i<(int)ans.size();i++){
auto tmp = ans[i];
cout << x.pm*tmp.first.first << " " << y.pm*tmp.first.second << " " << x.pm*tmp.second.first << " " << y.pm*tmp.second.second << endl;
}
return(0);
}
Submission Info
Submission Time |
|
Task |
B - 交点 |
User |
btk15049 |
Language |
C++11 (GCC 4.9.2) |
Score |
100 |
Code Size |
2530 Byte |
Status |
AC |
Exec Time |
24 ms |
Memory |
928 KB |
Judge Result
Set Name |
All |
Score / Max Score |
100 / 100 |
Status |
|
Set Name |
Test Cases |
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 |
Case Name |
Status |
Exec Time |
Memory |
scrambled_00.txt |
AC |
23 ms |
796 KB |
scrambled_01.txt |
AC |
22 ms |
800 KB |
scrambled_02.txt |
AC |
23 ms |
796 KB |
scrambled_03.txt |
AC |
23 ms |
924 KB |
scrambled_04.txt |
AC |
22 ms |
924 KB |
scrambled_05.txt |
AC |
22 ms |
928 KB |
scrambled_06.txt |
AC |
22 ms |
796 KB |
scrambled_07.txt |
AC |
22 ms |
796 KB |
scrambled_08.txt |
AC |
22 ms |
800 KB |
scrambled_09.txt |
AC |
22 ms |
800 KB |
scrambled_10.txt |
AC |
22 ms |
804 KB |
scrambled_11.txt |
AC |
23 ms |
752 KB |
scrambled_12.txt |
AC |
22 ms |
748 KB |
scrambled_13.txt |
AC |
24 ms |
924 KB |
scrambled_14.txt |
AC |
24 ms |
924 KB |
scrambled_15.txt |
AC |
22 ms |
928 KB |
scrambled_16.txt |
AC |
22 ms |
928 KB |
scrambled_17.txt |
AC |
22 ms |
808 KB |
scrambled_18.txt |
AC |
22 ms |
920 KB |
scrambled_19.txt |
AC |
22 ms |
796 KB |
scrambled_20.txt |
AC |
22 ms |
928 KB |
scrambled_21.txt |
AC |
22 ms |
848 KB |
scrambled_22.txt |
AC |
22 ms |
924 KB |
scrambled_23.txt |
AC |
22 ms |
812 KB |
scrambled_24.txt |
AC |
22 ms |
804 KB |
scrambled_25.txt |
AC |
22 ms |
804 KB |
scrambled_26.txt |
AC |
22 ms |
804 KB |