第十届蓝桥杯题解

第十届蓝桥杯题解(个人向) 第一题 平方和 算$1 ​$到$2019​$中含有$2,0,1,9​$的数的平方和。 #include using #define #define #define #define typedef typedef const //head bool while int x /= 10 if } return } int #ifdef freopen("1.in" #endif ll ans = 0 rep(i,1 if } printf return } 第二题 数列求值 求类似斐波那契数列$f[i] = f[i-1] + f[i-2] + f[i-3]$ ,求$f[20190324]%10000$。 ...

March 29, 2019 · 1 min · CheaSim

蓝桥杯历届题目

还有6天蓝桥杯了 开始刷历届练习题了。 小计算器 题意 实现一个直接的计算器。没有四则运算规则优先级。并且能够有进制转换 题解 数字转换字符串的时候,$0$是关键点。 ac代码 #include using #define #define #define #define typedef typedef typedef const //head int const const char int char void memset ull t = k; int if while if ans[cnt++] = x%t+'0' }else ans[cnt++] = x%t+'A' } x/=t; } int rep(i,0 } char ull real_num int ull t = 0 ull cnt = 1 per(i,0 if t += cnt * (tt[i] - 'A' }else t += cnt * (tt[i] - '0' } cnt*= k; } return } int #ifdef freopen("1.in" #endif cin ull now = 0 int k = 10 bool rep(i,0 cin if now = 0 init = true }else cin ull temp = real_num(); if now = temp; init = false continue } if else else else else }else sign = 1 }else sign = 2 }else sign = 3 }else sign = 4 }else sign = 5 }else solve(now); cout }else cin } } return } 合根植物 题意 并查集 ...

March 18, 2019 · 1 min · CheaSim