2018-2019 ACM-ICPC, Asia Jiaozuo Regional Contest


2018-2019 ACM-ICPC, Asia Jiaozuo Regional Contest

https://codeforces.com/gym/102028

2020-12-11 --时间

  • A.
    • 签到
         const int maxn = 1e5 + 7;
         int t, n;
      
         char s[10][1000] = {
             "Typically Otaku", "Eye-opener", "Young Traveller",
                             "Excellent Traveller",
                             "Contemporary Xu Xiake"};
      
         void solve() {
             
             cin >> t;
             while (t--) {
             
                 int cnt = 0;
                 for (int i = 1; i <= 4; i++) {
             
                     cin >> n;
                     if (n)
                         cnt++;
                 }
                 cout << s[cnt] << endl;
             }
         }
      
  • I.
    • 贪心+前缀和
         const int maxn = 1e5 + 7;
         int t, n;
         ll a[maxn], pre[maxn], sum;
      
         void solve() {
             
             cin >> t;
             while (t--) {
             
                 cin >> n;
                 pre[1] = 0;
                 for (int i = 1; i < n; i++)
                     cin >> a[i], pre[i] = a[i] + pre[i - 1];
                 ll lasum = 0, ad = 0;
                 for (int k = 1; k <= n; k++) {
             
                     if (k % 2 == 0)
                         ad += pre[n - k / 2] - pre[k / 2 - 1];
                     lasum += ad;
                     if (k != n)
                         cout << lasum << " ";
                     else
                         cout << lasum << endl;
                 }
             }
         }
      
  • D.计算几何
    • 相似三角,计算时避免使用 arctan,还有就是a > b 改成 a > b - esp
    •     const int maxn = 1e5 + 7;
          int t, n;
      
          const long double pi = acos(-1);
      
          void solve() {
             
              cin >> t;
              while (t--) {
             
                  long double a, b, r, d;
                  cin >> a >> b >> r >> d;
                  long double len = sqrt((r + a) * (r + a) + b * b);
                  long double tand = acos((a + r) / len);
                  d = d / 180 * pi;
                  if (d >= tand || fabs(d - tand) < 1e-6)
                      cout << fixed << setprecision(13) << len - r << endl;
                  else {
             
                      long double B = a + r, A = tan(d) * B, C = B / cos(d);
                      long double c0 = b - A, a0 = c0 * sin(d);
                      cout << fixed << setprecision(13) << a0 + C - r << endl;
                  }
              }
          }
      
  • E.大数+素数
    • 计算前60个素数组成所有集合的倒数和,推下公式打表写.不然会tle
    • tle代码:
          #include <bits/stdc++.h>
      
          #define ll long long
          using namespace std;
      
          #ifndef ONLINE_JUDGE
          clock_t prostart = clock();
          #endif
      
          const int maxn = 1e4 + 7;
      
          struct Wint : vector<int> {
             
              Wint(int n = 0) {
             
                  push_back(n);
                  check();
              }
      
              Wint &check() {
             
                  while (!empty() && !back())
                      pop_back();
                  if (empty())
                      return *this;
                  for (int i = 1; i < size(); ++i) {
             
                      (*this)[i] += (*this)[i - 1] / 10;
                      (*this)[i - 1] %= 10;
                  }
                  while 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值