A Rotate 2 sec 1024 MB Submit
按题意直接输出即可 s2 s1 s0
B Visibility 2 sec 1024 MB Submit
按题意直接在点(x,y) 的上下左右走一遍就行
C ORXOR 2 sec 1024 MB Submit
题目的n 20, 所以可以直接用位枚举 2^20 ~= 10^6, 用这个数位暴力枚举哪些被分成OR 那些被XOR
D Opposite 2 sec 1024 MB Submit
这题的话需要知道一个绕点旋转公式
点x0,y0 绕点 xm,ym 旋转a角度变成 x,y (圆上的n个点 可以看成是x0,y0 绕圆心旋转n次得到的)
圆心的坐标可以通过给的两点坐标的中点得到 因为总共N个点 给的两个点是第一个点 和 第N/2+1个点,这两个点就是圆的一个直径。 然后转过的角度就是360分成了 N块得到的
#include <bits/stdc++.h> using namespace std; #define ll long long #define _for(i,a,b) for(int i = (a); i < (b); i++) #define _rep(i,a,b) for(int i = (a); i <= (b); i++) #define all(v) (v).begin(), (v).end()
void taskA() { string s; cin >> s; cout << s[1] << s[2] << s[0]; return; }
void taskB() { int n,m; cin >> n >> m; int x,y; cin >> x >> y; int square[110][110]; _for(i,0,n) { string s; cin >> s; _for(j,0,m) square[i][j] = (s[j] == '.' ? 1 : 0); } x--, y--; int ans = 0; for(int i = x-1; i >= 0; i--) if(square[i][y] == 1) ans++; else break; for(int i = x+1; i < n; i++) if(square[i][y] == 1) ans++; else break; for(int i = y-1; i >= 0; i--) if(square[x][i] == 1) ans++; else break; for(int i = y+1; i < m; i++) if(square[x][i] == 1) ans++; else break; cout << ans+1 << " "; return; }
void taskC() { int n; cin >> n; vector<int> a(n); _for(i,0,n) cin >> a[i]; int res = (int)2e9; //cout << " res = " << res << " "; _for(i,0,1<<n-1) { int xord = 0, ord = 0; _for(j,0,n+1) { if(j < n) ord |= a[j]; if(j == n or (i & (1<<j))) xord ^= ord, ord = 0; } res = min(res, xord); } cout << res << " "; return; }
#define PI acos(-1) void taskD() { double n, x0, y0, x1, y1; cin >> n >> x0 >> y0 >> x1 >> y1; double a = 2*PI/n; double xm = (x0+x1)/2; double ym = (y0+y1)/2; double x = (x0-xm)*cos(a) - (y0-ym)*sin(a)+xm; double y = (x0-xm)*sin(a) + (y0-ym)*cos(a)+ym; cout << " PI = " << PI << " "; cout << setiosflags(ios::fixed) << setprecision(11) << x << " "; cout << setiosflags(ios::fixed) << setprecision(11) << y << " "; return; }
int main() { ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); taskD(); //task10391(); //task1595(); #ifdef LOCAL //assert(freopen("i.txt", "r", stdin)); assert(freopen("o.txt", "w", stdout)); //freopen("i.txt", "r", stdin); freopen("o.txt", "w", stdout); cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl; #endif return 0; }