NC243726. Elemental resonance
描述
Name | Element | Effects |
Fervent Flames | At least two Pyro | Affected by Cryo for 40% less time. Increases ATK by 25%. |
Soothing Water | At least two Hydro | Affected by Pyro for 40% less time. Increases Max HP by 25%. |
High Voltage | At least two Electro | Affected by Hydro for 40% less time. Superconduct, Overloaded, Electro-Charged, Quicken, Aggravate, or Hyperbloom have a 100% chance to generate an Electro Elemental Particle (CD: 5s). |
Shattering Ice | At least two Cryo | Affected by Electro for 40% less time. Increases CRIT Rate against enemies that are Frozen or affected by Cryo by 15%. |
Impetuous Winds | At least two Anemo | Decreases Stamina Consumption by 15%. Increases Movement SPD by 10%. Shortens Skill CD by 5%. |
Enduring Rock | At least two Geo | Increases shield strength by 15%. Additionally, characters protected by a shield will have the following special characteristics: DMG dealt increased by 15%, dealing DMG to enemies will decrease their Geo RES by 20% for 15s. |
Sprawling Greenery | At least two Dendro | Elemental Mastery increased by 50. After triggering Burning, Quicken, or Bloom reactions, all nearby party members gain 30 Elemental Mastery for 6s. After triggering Aggravate, Spread, Hyperbloom, or Burgeon reactions, all nearby party members gain 20 Elemental Mastery for 6s. The durations of the aforementioned effects will be counted independently. |
Protective Canopy | Any 4 Unique Elements | All Elemental RES +15%, Physical RES +15%. |
输入描述
A line of four words representing elements. The word can be one of following:Pyro, Hydro, Electro, Cryo, Anemo, Geo, Dendro
输出描述
Several lines represent element resonance, one per line in lexicographical orderPlease output strictly by name:Fervent Flames, Soothing Water, High Voltage, Shattering Ice, Impetuous Winds, Enduring Rock, Sprawling Greenery, Protective Canopy
示例1
输入:
Cryo Cryo Cryo Cryo
输出:
Shattering Ice
C++(g++ 7.5.0) 解法, 执行用时: 3ms, 内存消耗: 400K, 提交时间: 2022-09-24 10:16:36
#include <bits/stdc++.h> using namespace std; int s[10]; string ms[8]={ "Enduring Rock", "Fervent Flames", "High Voltage", "Impetuous Winds", "Shattering Ice", "Soothing Water", "Sprawling Greenery", "Protective Canopy", }; int main() { char ch[10]; for(int i=0;i<4;i++){ scanf("%s",ch); if(ch[0]=='P')s[1]++; if(ch[0]=='H')s[5]++; if(ch[0]=='E')s[2]++; if(ch[0]=='C')s[4]++; if(ch[0]=='A')s[3]++; if(ch[0]=='G')s[0]++; if(ch[0]=='D')s[6]++; } bool flag=0; for(int i=0;i<7;i++)if(s[i]>1){ cout<<ms[i]<<endl; flag=1; } if(!flag)cout<<ms[7]<<endl; return 0; }
C++(clang++ 11.0.1) 解法, 执行用时: 2ms, 内存消耗: 408K, 提交时间: 2022-09-24 10:03:56
#include <iostream> #include <map> #include <stdio.h> using namespace std; map<char, int> S; int cnt = 4; int main() { for(int i = 0; i < 4; ++i) { string a; cin >> a; if(!S[a[0]]) cnt--; S[a[0]] ++; } if(S['G'] >= 2) printf("Enduring Rock\n"); if(S['P'] >= 2) printf("Fervent Flames\n"); if(S['E'] >= 2) printf("High Voltage\n"); if(S['A'] >= 2) printf("Impetuous Winds\n"); if(!cnt) printf("Protective Canopy\n"); if(S['C'] >= 2) printf("Shattering Ice\n"); if(S['H'] >= 2) printf("Soothing Water\n"); if(S['D'] >= 2) printf("Sprawling Greenery\n"); return 0; }
Python3 解法, 执行用时: 44ms, 内存消耗: 4572K, 提交时间: 2022-09-24 10:52:00
import sys e = { "Pyro": "Fervent Flames", "Hydro": "Soothing Water", "Electro": "High Voltage", "Cryo": "Shattering Ice", "Anemo": "Impetuous Winds", "Geo": "Enduring Rock", "Dendro": "Sprawling Greenery" } f = {} for line in sys.stdin: a = line.split() for i in a: if i not in f: f[i] = 0 f[i] += 1 if len(f) == 4: print("Protective Canopy") else: for i in ["Geo", "Pyro", "Electro", "Anemo", "Cryo", "Hydro", "Dendro"]: if f.get(i, 0) >= 2: print(e[i])
pypy3 解法, 执行用时: 68ms, 内存消耗: 21172K, 提交时间: 2022-09-24 09:59:20
ls = list(input().split()) ans = [] dic = { "Pyro": "Fervent Flames", "Hydro": "Soothing Water", "Cryo": "Shattering Ice", "Electro": "High Voltage", "Anemo": "Impetuous Winds", "Geo": "Enduring Rock", "Dendro": "Sprawling Greenery" } for x in dic.keys(): if ls.count(x) >= 2: ans.append(dic[x]) if not ans: ans.append("Protective Canopy") ans.sort() print("\n".join(ans))