zoukankan      html  css  js  c++  java
  • 【UOJ Easy Round #2】

    然而UER我也照样跪……

    第一题

      忘了取模sad

      || 操作符将整个区间分成了一些段,每个手机只会执行其中某一段,执行次数为这一段中&&的个数?+1?

      ans=ans*num[i]+1

      倒着搞了一遍就过了?……然而我并不知道为什么……

     1 //UER 2 A
     2 #include<vector>
     3 #include<cstdio>
     4 #include<cstring>
     5 #include<cstdlib>
     6 #include<iostream>
     7 #include<algorithm>
     8 #define rep(i,n) for(int i=0;i<n;++i)
     9 #define F(i,j,n) for(int i=j;i<=n;++i)
    10 #define D(i,j,n) for(int i=j;i>=n;--i)
    11 using namespace std;
    12 typedef long long LL;
    13 inline int getint(){
    14     int r=1,v=0; char ch=getchar();
    15     for(;!isdigit(ch);ch=getchar()) if (ch=='-') r=-1;
    16     for(; isdigit(ch);ch=getchar()) v=v*10-'0'+ch;
    17     return r*v;
    18 }
    19 const int N=1e5+10,mod=998244353;
    20 /*******************template********************/
    21 
    22 LL a[N],b[N],f[N],n;
    23 
    24 int main(){
    25 #ifndef ONLINE_JUDGE
    26     freopen("A.in","r",stdin);
    27 //    freopen("A.out","w",stdout);
    28 #endif 
    29     n=getint();
    30     char s[5];
    31     F(i,1,n-1){
    32         scanf("%s",s);
    33         if (s[0]=='&') a[i]=1;
    34         else a[i]=0;
    35     }
    36 //    F(i,1,n) printf("%d ",a[i]); puts("");
    37     int cnt=0,tmp=1;
    38     F(i,1,n){
    39         if (a[i]) tmp++;
    40         else b[++cnt]=tmp,tmp=1;
    41     }
    42 //    F(i,1,cnt)printf("%d ",b[i]); puts("");
    43     LL ans=1;
    44     D(i,cnt,1){
    45         ans=(ans*b[i]+1)%mod;
    46     }
    47     printf("%lld
    ",ans);
    48     return 0;
    49 }
    View Code

    然而后两题并不会做……又是一个坑啊……什么时候能填上呢?

  • 相关阅读:
    Docker创建tomcat镜像简单使用
    Eclipse和Jdk版本问题
    HashTable源码阅读
    HashMap源码阅读
    报错:Multiple annotations found at this line:
    python全栈开发学习03
    python全栈开发学习 02
    关于termux在手机上搭载Linux系统,python,ssh
    python全栈开发学习 01
    机器学习实战
  • 原文地址:https://www.cnblogs.com/Tunix/p/4511419.html
Copyright © 2011-2022 走看看