• 2018-3-17-湖南多校第二场


                       湖南多校第2场

    A:太水 队友直接秒了

    C: Hedwig's Ladder

        队友打了个表,然后一眼规律 类似于斐波拉契

      

     1 #include <cstdio>
     2 #include <cstring>
     3 #include <queue>
     4 #include <cmath>
     5 #include <algorithm>
     6 #include <set>
     7 #include <iostream>
     8 #include <map>
     9 #include <stack>
    10 #include <string>
    11 #include <vector>
    12 #include <bits/stdc++.h>
    13 #define  pi acos(-1.0)
    14 #define  eps 1e-9
    15 #define  fi first
    16 #define  se second
    17 #define  rtl   rt<<1
    18 #define  rtr   rt<<1|1
    19 #define  bug         printf("******
    ")
    20 #define  mem(a,b)    memset(a,b,sizeof(a))
    21 #define  name2str(x) #x
    22 #define  fuck(x)     cout<<#x" = "<<x<<endl
    23 #define  f(a)        a*a
    24 #define  sf(n)       scanf("%d", &n)
    25 #define  sff(a,b)    scanf("%d %d", &a, &b)
    26 #define  sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    27 #define  sffff(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)
    28 #define  pf          printf
    29 #define  FRE(i,a,b)  for(i = a; i <= b; i++)
    30 #define  FREE(i,a,b) for(i = a; i >= b; i--)
    31 #define  FRL(i,a,b)  for(i = a; i < b; i++)+
    32 #define  FRLL(i,a,b) for(i = a; i > b; i--)
    33 #define  FIN         freopen("data.txt","r",stdin)
    34 #define  gcd(a,b)    __gcd(a,b)
    35 #define  lowbit(x)   x&-x
    36 #define rep(i,a,b) for(int i=a;i<b;++i)
    37 #define per(i,a,b) for(int i=a-1;i>=b;--i)
    38 using namespace std;
    39 typedef long long  LL;
    40 typedef unsigned long long ULL;
    41 const int INF = 0x3f3f3f3f;
    42 const LL INFLL = 0x3f3f3f3f3f3f3f3fLL;
    43 const int maxn = 1e6 + 7;
    44 const int mod = 10007;
    45 int T,n,a[maxn];
    46 int main() {
    47     sf(T);
    48     a[1]=2,a[2]=3,a[3]=6;
    49     for (int i=4 ;i<=1000 ;i++) a[i]=(a[i-1]+a[i-2]+(i%2!=0))%mod;
    50     for (int t=1,x ;t<=T ;t++){
    51         sff(x,n);
    52         printf("%d %d
    ",t,a[n]);
    53     }
    54     return 0 ;
    55 }
    View Code

    E: What time is it anyway?

          我的两个SB队友小时也用%02d输出,卡了一年,我在看其他的题目,认为他们两个可以很容易写了,后面我看不下去了,发现他们用小时输出用%02d 当时心态就崩了

          题意:模拟题 给你n个时间,和n个相差的时间,让你求你这n个表都一一对应的时间只有一个合法解就输出时间 多个就输出数目 没有输出none

      

     1 #include <cstdio>
     2 #include <cstring>
     3 #include <queue>
     4 #include <cmath>
     5 #include <algorithm>
     6 #include <set>
     7 #include <iostream>
     8 #include <map>
     9 #include <stack>
    10 #include <string>
    11 #include <vector>
    12 #include <bits/stdc++.h>
    13 #define  pi acos(-1.0)
    14 #define  eps 1e-9
    15 #define  fi first
    16 #define  se second
    17 #define  rtl   rt<<1
    18 #define  rtr   rt<<1|1
    19 #define  bug         printf("******
    ")
    20 #define  mem(a,b)    memset(a,b,sizeof(a))
    21 #define  name2str(x) #x
    22 #define  fuck(x)     cout<<#x" = "<<x<<endl
    23 #define  f(a)        a*a
    24 #define  sf(n)       scanf("%d", &n)
    25 #define  sff(a,b)    scanf("%d %d", &a, &b)
    26 #define  sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    27 #define  sffff(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)
    28 #define  pf          printf
    29 #define  FRE(i,a,b)  for(i = a; i <= b; i++)
    30 #define  FREE(i,a,b) for(i = a; i >= b; i--)
    31 #define  FRL(i,a,b)  for(i = a; i < b; i++)+
    32 #define  FRLL(i,a,b) for(i = a; i > b; i--)
    33 #define  FIN         freopen("data.txt","r",stdin)
    34 #define  gcd(a,b)    __gcd(a,b)
    35 #define  lowbit(x)   x&-x
    36 #define rep(i,a,b) for(int i=a;i<b;++i)
    37 #define per(i,a,b) for(int i=a-1;i>=b;--i)
    38 using namespace std;
    39 typedef long long  LL;
    40 typedef unsigned long long ULL;
    41 const int INF = 0x3f3f3f3f;
    42 const LL INFLL = 0x3f3f3f3f3f3f3f3fLL;
    43 const int maxn = 1e6 + 7;
    44 int T, n, num1[12], num2[12], num3[12];
    45 map<int, int>vis;
    46 set<int>ans;
    47 int main() {
    48    // FIN;
    49     sf ( T );
    50     for ( int t = 1, x ; t <= T ; t++ ) {
    51         ans.clear();
    52         sff ( x, n );
    53         for ( int i = 0, a, b ; i < n ; i++ ) {
    54             scanf ( "%d:%d", &a, &b );
    55             num1[i] = a * 60 + b;
    56             if (num1[i]>=720) num1[i]%=720;
    57         }
    58         getchar();
    59         char op;
    60         for ( int i = 0, a, b ; i < n ; i++ ) {
    61             scanf ( " %c%d:%d", &op, &a, &b );
    62             if ( op == '+' ) num2[i] = a * 60 + b;
    63             else num2[i] = - ( a * 60 + b );
    64             vis[num2[i]]++;
    65         }
    66         for ( int i = 0 ; i < n ; i++ ) {
    67             num3[i] = num1[0] - num2[i];
    68             if ( num3[i] < 0 ) num3[i] += 720;
    69             if ( num3[i] >= 720 ) num3[i] %= 720;
    70         }
    71         for ( int i = 0 ; i < n ; i++ ) {
    72             int flag = 1;
    73             vis.clear();
    74             for ( int j = 0 ; j < n ; j++ ) vis[num1[j]]++;
    75             for ( int j = 0 ; j < n ; j++ ) {
    76                 int cnt = num3[i] + num2[j];
    77                 if ( cnt >= 720 ) cnt %= 720;
    78                 if ( cnt < 0 ) cnt += 720;
    79                 if ( !vis[cnt] ) {
    80                     flag = 0;
    81                     break;
    82                 }
    83                 vis[cnt]--;
    84             }
    85             if ( flag ) ans.insert( num3[i] );
    86         }
    87         if ( ans.size() == 0 ) printf ( "%d none
    ", t );
    88         else if ( ans.size() == 1 ) {
    89             int a = *ans.begin() / 60, b = *ans.begin() % 60;
    90             if ( a == 0 ) a = 12;
    91             printf ( "%d %d:%02d
    ", t, a, b );
    92         } else printf ( "%d %d
    ", t, ans.size() );
    93     }
    94     return 0 ;
    95 }
    View Code

    H: Subprime Fibonacci Sequence

          让你求出循环节 这题题目已经告诉你如何求出循环节了 然后被卡了好久  SB了  ak = am and ak − 1 = am − 1  

     找到两个相同的就行了,应该是这种数列的性质

       

     1 #include <cstdio>
     2 #include <cstring>
     3 #include <queue>
     4 #include <cmath>
     5 #include <algorithm>
     6 #include <set>
     7 #include <iostream>
     8 #include <map>
     9 #include <stack>
    10 #include <string>
    11 #include <vector>
    12 #include <bits/stdc++.h>
    13 #define  pi acos(-1.0)
    14 #define  eps 1e-9
    15 #define  fi first
    16 #define  se second
    17 #define  rtl   rt<<1
    18 #define  rtr   rt<<1|1
    19 #define  bug         printf("******
    ")
    20 #define  mem(a,b)    memset(a,b,sizeof(a))
    21 #define  name2str(x) #x
    22 #define  fuck(x)     cout<<#x" = "<<x<<endl
    23 #define  f(a)        a*a
    24 #define  sf(n)       scanf("%d", &n)
    25 #define  sff(a,b)    scanf("%d %d", &a, &b)
    26 #define  sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    27 #define  sffff(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)
    28 #define  pf          printf
    29 #define  FRE(i,a,b)  for(i = a; i <= b; i++)
    30 #define  FREE(i,a,b) for(i = a; i >= b; i--)
    31 #define  FRL(i,a,b)  for(i = a; i < b; i++)+
    32 #define  FRLL(i,a,b) for(i = a; i > b; i--)
    33 #define  FIN         freopen("data.txt","r",stdin)
    34 #define  gcd(a,b)    __gcd(a,b)
    35 #define  lowbit(x)   x&-x
    36 #define rep(i,a,b) for(int i=a;i<b;++i)
    37 #define per(i,a,b) for(int i=a-1;i>=b;--i)
    38 using namespace std;
    39 typedef long long  LL;
    40 typedef unsigned long long ULL;
    41 const int INF = 0x3f3f3f3f;
    42 const LL INFLL = 0x3f3f3f3f3f3f3f3fLL;
    43 const int maxn = 1e6 + 7;
    44 int num, vis[maxn], prime[maxn], vis1[maxn];
    45 int T, n, a[1010],len, idx;
    46 void init() {
    47     num = 0, vis1[1] = 1;
    48     for ( int i = 2 ; i < maxn ; i++ ) {
    49         if ( vis[i] ) continue;
    50         for ( int j = 2 * i ; j < maxn ; j += i ) vis[j] = 1;
    51         vis1[i] = 1, prime[num++] = i;
    52     }
    53 }
    54 int getnum ( int x ) {
    55     if ( vis1[x] ) return x;
    56     for ( int i = 0 ; i < num ; i++ )
    57         if ( x % prime[i] == 0 ) return x / prime[i];
    58 }
    59 map<int, int>mp;
    60 int main() {
    61     //FIN;
    62     init();
    63     sf ( T );
    64     for ( int t = 1, x ; t <= T ; t++ ) {
    65         mp.clear();
    66         len = 0, idx = 0;
    67         mem ( a, 0 );
    68         sffff ( x, n, a[0], a[1] );
    69         for ( int i = 2 ; i <= n ; i++ ) a[i] = getnum ( a[i - 1] + a[i - 2] );
    70       //  for ( int i = 0 ; i <= n ; i++ ) printf ( "%d%c", a[i], i == n ? '
    ' : ' ' );
    71         for ( int i = 0 ; i <= n-1 ; i++ ) {
    72             if (mp[a[i]*10000+a[i+1]]) {
    73                 idx=i;
    74                 len=idx-mp[a[i]*10000+a[i+1]];
    75                 break;
    76             }
    77             mp[a[i]*10000+a[i+1]]=i;
    78         }
    79         if ( !len )   printf ( "%d %d 0
    %d
    ", t, n, a[n] );
    80         else {
    81             for ( int i = 0, j = 0 ; i <= n ; i++ ) {
    82                 if ( a[i] == a[i + len] ) {
    83                     if ( j == 0 ) idx = i + len;
    84                     j++;
    85                     if ( j == 2 ) break;
    86                 } else j = 0;
    87             }
    88             printf ( "%d %d %d
    ", t, idx + 1, len );
    89             int res = 0;
    90             for ( int i = idx - len; i <= idx + 1; i++ ) {
    91                 res++;
    92                 if ( res == 20 || i == idx + 1 )  printf ( "%d
    ", a[i] ), res = 0;
    93                 else printf ( "%d ", a[i] );
    94             }
    95             // if ( res ) printf ( "
    " );
    96         }
    97     }
    98     return 0 ;
    99 }
    View Code

    G: The Erdös-Straus Conjecture

        这题没什么想法,大佬告诉我这题枚举就行了,后面发现开了10S枚举 也不会T 

         

       

     1 #include <cstdio>
     2 #include <cstring>
     3 #include <queue>
     4 #include <cmath>
     5 #include <algorithm>
     6 #include <set>
     7 #include <iostream>
     8 #include <map>
     9 #include <stack>
    10 #include <string>
    11 #include <vector>
    12 #include <bits/stdc++.h>
    13 #define  pi acos(-1.0)
    14 #define  eps 1e-9
    15 #define  fi first
    16 #define  se second
    17 #define  rtl   rt<<1
    18 #define  rtr   rt<<1|1
    19 #define  bug         printf("******
    ")
    20 #define  mem(a,b)    memset(a,b,sizeof(a))
    21 #define  name2str(x) #x
    22 #define  fuck(x)     cout<<#x" = "<<x<<endl
    23 #define  f(a)        a*a
    24 #define  sf(n)       scanf("%d", &n)
    25 #define  sff(a,b)    scanf("%d %d", &a, &b)
    26 #define  sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    27 #define  sffff(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)
    28 #define  pf          printf
    29 #define  FRE(i,a,b)  for(i = a; i <= b; i++)
    30 #define  FREE(i,a,b) for(i = a; i >= b; i--)
    31 #define  FRL(i,a,b)  for(i = a; i < b; i++)+
    32 #define  FRLL(i,a,b) for(i = a; i > b; i--)
    33 #define  FIN         freopen("data.txt","r",stdin)
    34 #define  gcd(a,b)    __gcd(a,b)
    35 #define  lowbit(x)   x&-x
    36 #define rep(i,a,b) for(int i=a;i<b;++i)
    37 #define per(i,a,b) for(int i=a-1;i>=b;--i)
    38 using namespace std;
    39 typedef long long  LL;
    40 typedef unsigned long long ULL;
    41 const int INF = 0x3f3f3f3f;
    42 const LL INFLL = 0x3f3f3f3f3f3f3f3fLL;
    43 const int maxn = 1e6 + 7;
    44 int T, t;
    45 LL n, a, b, c;
    46 void solve() {
    47     a = n / 4 + 1;
    48     while ( 1 ) {
    49         LL x = 4 * a - n;
    50         LL y = a * n;
    51         LL temp = gcd ( x, y );
    52         x /= temp, y /= temp;
    53         b = y / x + 1;
    54         for ( ; b <= 2 * y / x ; b++ ) {
    55             LL x1 = x * b - y;
    56             LL y1 = y * b;
    57             if ( y1 % x1 == 0 ) {
    58                 printf ( "%d %lld %lld %lld
    ", t, a, b, y1/x1 );
    59                 return ;
    60             }
    61         }
    62         a++;
    63     }
    64 }
    65 int main() {
    66     sf ( T );
    67     for ( t = 1; t <= T ; t++ ) {
    68         int x;
    69         sff ( x, n );
    70         solve();
    71     }
    72     return 0 ;
    73 }
    View Code

     

  • 相关阅读:
    Redis详解
    Linux常用命令
    sqlserver 游标写法
    Flask总结
    HTTPS协议
    Django REST framework 简介
    Cookie和session
    利用rest-framework编写逻辑关系
    vuex
    jQuery和Bootstrap的优点
  • 原文地址:https://www.cnblogs.com/qldabiaoge/p/10560377.html
Copyright © 2020-2023  润新知