2024牛客寒假营Day2||ABEF
原文地址
A-Tokitsukaze and Bracelet
题意
根据手环的三个属性值判断手环的等级。
- 对攻击百分比来说,+0为100%,+1为150%,+2为200%
- 对体力和精神来说,+0在 { 29 , 30 , 31 , 32 } \{29,30,31,32\} {29,30,31,32}里选择,+1在 { 34 , 36 , 38 , 40 } \{34,36,38,40\} {34,36,38,40}里选择,+2固定为45
数据范围
n ( 1 ≤ n ≤ 100 ) n(1≤n≤100) n(1≤n≤100)
a i , b i , c i ( a i ∈ { 100 , 150 , 200 } ; b i , c i ∈ { 29 , 30 , 31 , 32 , 34 , 36 , 38 , 40 , 45 } ) a_i,b_i,c_i(a_i∈\{100,150,200\};b_i,ci∈\{29,30,31,32,34,36,38,40,45\}) ai,bi,ci(ai∈{100,150,200};bi,ci∈{29,30,31,32,34,36,38,40,45})
思路
模拟即可
参考代码
void solve() { int lv1[3] = { 100,150,200 }; int lv2[9] = { 29,30,31,32,34,36,38,40,45 }; int a, b, c;cin >> a >> b >> c; int ans = 0; for (int i = 0;i > m >> k; mapcats; int ans = 0; while (k--) { int x, y;cin >> x >> y; cats[{ x, y }] = true; pairpu = { x - 1,y }, pd = { x + 1,y }, pl = { x,y - 1 }, pr = { x,y + 1 }; int cnt = 4; if (cats.count(pu) != 0)cnt -= 1; if (cats.count(pd) != 0)cnt -= 1; if (cats.count(pl) != 0)cnt -= 1; if (cats.count(pr) != 0)cnt -= 1; ans += cnt; } cout int n;cin n; vectorcol(n + 1); setcls; for (int i = 1;i cin > col[i]; cls.insert(col[i]); } int tn = cls.size(); // 颜色种数 mapclrs; mapcolors; int ans = 0; int cnt = 0; int pi = n; while (tn != 0) { for (int i = n;i > 0;i--) { colors[col[i]]++; if (colors[col[i]] == 1) { cnt++; // 达到两次及以上的颜色数 if (cnt == tn) { ans++; cnt = 0; colors = clrs; pi = i - 1; } } } tn = colors.size(); colors = clrs; n = pi;cnt = 0; } cout