ICPC 2022 网络赛 h (模拟

#include
using namespace std;
using VI = vector;
using ll = long long;
const int mod = 20220911;

//枚举数位,枚举这一位余数是几
//每一位的限制,
//如果有repeat 就下一个
int change(string x){
    int res = 0 ;
    for(int i = 0 ; i < x.size() ; i++){
       res *= 10;
       res += (x[i] - '0');
    }
    return res;

}


int dfs(int res){
    string s;
    int ct = 0;
    int k = 0;
    while(cin >> s){
        if(s == "library"){
            ct++;
        }else if(s == "arithmetic"){

        }else if(s == "fin"){
            return (ct * max(k,1)) % mod;
        }else if(s == "times"){
            return (ct * max(k,1)) % mod;
        }else if(s == "repeat"){
            ct += dfs(0);
            ct = ct % mod;
            //son = son % mod;
        }else if(s == "for"){
        }else{
            k += change(s);
        }
    }
}



int main(){
   // repeat //library repeat repeat library for 3 times arithmetic library for 3 times// for 100 times fin
   //
   /*for(100){
     1;
     for(3){
        for(3){
            l
        }
        a , l
     }
   }*/
    cout<

模拟,难度不大 

你可能感兴趣的:(基本算法,算法)