Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- /** Interface */
- template <class T = int>
- inline T readInt(); // skip spaces, read signed int
- inline int readUInt(); // skip spaces, read unsigned int
- inline int readChar(); // skip spaces, read char
- inline void readWord( char *s ); // skip spaces, read word
- template <class T>
- inline void writeInt( T x );
- inline void writeChar( int x ); // you may use putchar() instead of it
- inline void writeWord( const char *s );
- inline void flush();
- #define ll long long
- #define file "real."
- const int NMAX = 1e6;
- struct complex1
- {
- double r, im;
- complex1(){ }
- complex1( double a, double b ) : r(a), im(b) { }
- complex1 dual () {return complex1(r, -im);}
- complex1 turn () {return complex1(im, -r);}
- complex1 operator - (const complex1 &a) const {return complex1((r - a.r)/2, (im - a.im)/2);}
- complex1 operator + (const complex1 &a) const {return complex1((r + a.r)/2, (im + a.im)/2);}
- };
- complex1 a, b;
- int main()
- {
- assert ( freopen (file "in", "r", stdin) );
- assert ( freopen (file "out", "w", stdout) );
- ll N = readInt();
- ll A = readInt();
- ll B = readInt();
- ll C = readInt();
- ll D = readInt();
- ll E = readInt();
- ll F = readInt();
- ll n = readInt();
- for (int i = 0; i < n; ++i)
- {
- ll j = readInt();
- complex1 c1, c2;
- ll x = (N - j) % N;
- c1.r = ((A + B*j) ^ (C*j))*(long double)(0.001);
- c1.im = ((D + E*j) ^ (F*j))*(long double)(0.001);
- c2.r = ((A + B*x) ^ (C*x))*(long double)(0.001);
- c2.im = ((D + E*x) ^ (F*x))*(long double)(0.001);
- c2 = c2.dual();
- a = c1 + c2;
- b = c1 - c2;
- b = b.turn();
- printf("%f %f ", a.r, a.im);
- printf("%f %f \n", b.r, b.im);
- }
- return 0;
- }
- /** Read */
- static const int buf_size = 4096;
- inline int getchar_fast() { // you may use getchar() instead of it
- static char buf[buf_size];
- static int len = 0, pos = 0;
- if (pos == len)
- pos = 0, len = fread(buf, 1, buf_size, stdin);
- if (pos == len)
- return -1;
- return buf[pos++];
- }
- inline int readChar() {
- int c = getchar_fast();
- while (c <= 32)
- c = getchar_fast();
- return c;
- }
- inline int readUInt() {
- int c = readChar(), x = 0;
- while ('0' <= c && c <= '9')
- x = x * 10 + c - '0', c = getchar_fast();
- return x;
- }
- template <class T>
- inline T readInt() {
- int s = 1, c = readChar();
- T x = 0;
- if (c == '-')
- s = -1, c = getchar_fast();
- while ('0' <= c && c <= '9')
- x = x * 10 + c - '0', c = getchar_fast();
- return s == 1 ? x : -x;
- }
- inline void readWord( char *s ) {
- int c = readChar();
- while (c > 32)
- *s++ = c, c = getchar_fast();
- *s = 0;
- }
- /** Write */
- static int write_pos = 0;
- static char write_buf[buf_size];
- inline void writeChar( int x ) {
- if (write_pos == buf_size)
- fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
- write_buf[write_pos++] = x;
- }
- inline void flush() {
- if (write_pos)
- fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
- }
- template <class T>
- inline void writeInt( T x ) {
- if (x < 0)
- writeChar('-'), x = -x;
- char s[24];
- int n = 0;
- while (x || !n)
- s[n++] = '0' + x % 10, x /= 10;
- while (n--)
- writeChar(s[n]);
- }
- inline void writeWord( const char *s ) {
- while (*s)
- writeChar(*s++);
- }
- /** End of magic */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement