[H - To begin or not to begin]
就是个简单的博弈,稍微研究一下就能发现这玩意是有规律的,判断一下奇偶就比较好做了
代码:
//去吧马里奥!把AC公主救回来! // ******** // ************ // ####....#. // #..###.....##.... // ###.......###### // ........... // ##*####### // ####*******###### // ...#***.****.*###.... // ....**********##..... // ....**** *****.... // #### #### // ###### ###### #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<string> #include<map> #include<sstream> #include<cstring> #include<vector> #include<queue> #define LL long long #define _64 __int64 using namespace std; int main(){ int k; while(cin >> k){ if(k % 2 == 1){ cout << 0 << endl; }else{ cout << 1 << endl; } } }
这个题讲的是给你一个n边形的凸面让你计算凸面面积,一开始我还以为是圆凸面,后来发现好像是多边形凸面,那就根据公式计算三角形面积就好了
代码:
//去吧马里奥!把AC公主救回来! // ******** // ************ // ####....#. // #..###.....##.... // ###.......###### // ........... // ##*####### // ####*******###### // ...#***.****.*###.... // ....**********##..... // ....**** *****.... // #### #### // ###### ###### #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<string> #include<map> #include<sstream> #include<cstring> #include<vector> #include<iomanip> #include<queue> #define LL long long #define _64 __int64 const double PI = atan(1.)*4.; using namespace std; int main(){ int n,d; while(cin >> n >> d){ double s = 0; for(int i = 0;i < n;i++){ double con; cin >> con; s += 0.5 * d * d * sin(con / 180.0 * PI) *1.0; } printf("%.3f\n",s); //cout << setprecision(3)<< s <<endl; } }
这个题是说给出一段数,之后从这些数的二进制里找有几个97,也就是a的ascii代码,一开始以为要拆成二进制做(实际上也那么做了),但是后来在点醒之下发现可以直接在十进制里操作256就可以了
代码:
//去吧马里奥!把AC公主救回来! // ******** // ************ // ####....#. // #..###.....##.... // ###.......###### // ........... // ##*####### // ####*******###### // ...#***.****.*###.... // ....**********##..... // ....**** *****.... // #### #### // ###### ###### #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<string> #include<map> #include<sstream> #include<cstring> #include<vector> #include<iomanip> #include<queue> #define LL long long #define _64 __int64 const double PI = atan(1.)*4.; using namespace std; int main(){ int n; while(cin >> n){ int ans = 0; for(int i = 0;i < n;i++){ LL a; int m = pow(2,8); cin >> a; while(a > 0){ if(a % m == 97){ ans++; } a = a/m; } } cout << ans << endl; } }