目录
1-1 无所谓,我会出手
1-2 数组总和
1-3 捡到一个矩形
1-4 字符转换
1-5 捡到了一个成绩
1-6 炎爆
1-7 攻略迷宫
1-8 Vampire Survivors
2-1 聚餐
2-2 捡到两个字符串
2-3 打印菱形 (Hard-ver)
2-4 弹弹珠 (Hard-ver)
3-1 最优选择
3-2 QR Code
3-3 Roll Math
请直接输出 :“It doesn't matter,I'll do it.”(输出不含引号)。
#include
int main()
{
printf("It doesn't matter,I'll do it.");
return 0;
}
#include
using namespace std;
typedef long long LL;
LL a[100000000];
int main() {
LL sum = 0, n,x;
cin >> n;
for (int i = 1; i <=n; i++)
{
cin >> x;
a[i] = x;
}
for (int i = 1; i <= n; i++)
{
sum += i * a[i];
}
cout << sum;
return 0;
}
#include
int main()
{
int x1,y1,x2,y2,a,b;
int t,i,j=0;
scanf("%d",&t);
int arr[1000];
for(i=0;i=x1&&a<=x2)&&(b>=y1&&b<=y2))
{
arr[j] = 1;
}
else
{
arr[j] = 0;
}
j++;
}
for(j=0;j
#include
#include
void reverse_string(char *str) {
int len = strlen(str);
int i,n;
for (i = 0;i < len; i++)
{
n=str[i]-96;
if (n>13)
{
str[i] = 'a'+(n-13)*2-1;
}
else
{
str[i] +=n;
}
}
}
int main() {
char str[100];
scanf("%s", str);
reverse_string(str);
printf("%s\n", str);
return 0;
}
上面这个越界了
#include
using namespace std;
int main() {
int a;
string ss;
cin >> ss;
for (int i = 0; i < ss.size(); i++)
{
a = ss[i] - 'a';
if((ss[i] + a + 1)<='z')
printf("%c", ss[i] + a+1);
else
printf("%c", ss[i] + a + 1-26);
}
return 0;
}
#include
int main()
{
int i,n,a;
double sum,avg;
scanf("%d",&n);
int arr[n];
for(i=0;iavg)
{
sum2+=arr[i];
}
}
printf("%.3lf\n",avg);
printf("%d",sum2);
return 0;
}
#include
#include
typedef long long LL;
using namespace std;
int a[101][101], n, q;
int main(){
cin >> n >> q;
for (int i = 1; i <= q; i++) {
int x, y; cin >> x >> y;
char op; cin >> op;
if (op == 'U') {
for (int j = x; j >= 1; j--) a[j][y] ++;
}
else if (op == 'R') {
for (int j = y; j <= n; j++) a[x][j] ++;
}
else if (op == 'D') {
for (int j = x; j <= n; j++) a[j][y] ++;
}
else {
for (int j = y; j >= 1; j--) a[x][j] ++;;
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
cout << a[i][j];
if (j != n) cout << ' ';
}
cout << endl;
}
return 0;
}
#include
#include
typedef long long LL;
using namespace std;
int sum(int h, int m, int s)
{
return h * 3600 + m * 60 + s;
}//全部转化为秒方便统计。
int main()
{
int x, y;
int h1, m1, s1, h2, m2, s2;
scanf("%d%d%d:%d:%d%d:%d:%d", &x, &y, &h1, &m1, &s1, &h2, &m2, &s2);
int sum1 = sum(h1, m1, s1);
int sum2 = sum(h2, m2, s2);
int cnt = min((sum2 - sum1) / y, x);//返回 cnt 如果生命值小 也就是被打死了,反之就是没被打死
int res = sum1 + cnt * y;//刚开始的时间加上攻击次数×每次时间
printf("%d\n%02d:%02d:%02d\n", cnt, res / 3600, res % 3600 / 60, res % 60);//h,m,s
return 0;
}
n = int(input()) # 获取武器的数量
# 创建字典存储武器数量
weapons = {}
for _ in range(n):
weapon = input() # 获取武器名称
if weapon in weapons:
weapons[weapon] += 1 # 更新武器数量
else:
weapons[weapon] = 1 # 添加新武器及数量
# 获取超级武器的攻击力
super_weapon_attacks = list(map(int, input().split()))
# 计算总攻击力
total_attack = 0
pass1 =1
while pass1 == 1:
pass1=0
if weapons.get('Magic_Wand') and weapons.get('Empty_Tome'):
total_attack += super_weapon_attacks[0]
weapons['Magic_Wand'] -= 1
weapons['Empty_Tome'] -= 1
pass1 = 1
if weapons.get('Axe') and weapons.get('Candelabrador'):
total_attack += super_weapon_attacks[1]
weapons['Axe'] -= 1
weapons['Candelabrador'] -= 1
pass1 = 1
if weapons.get('Knife') and weapons.get('Bracer'):
total_attack += super_weapon_attacks[2]
weapons['Knife'] -= 1
weapons['Bracer'] -= 1
pass1 = 1
if weapons.get('Cross') and weapons.get('Clover'):
total_attack += super_weapon_attacks[3]
weapons['Cross'] -= 1
weapons['Clover'] -= 1
pass1 = 1
if weapons.get('King_Bible') and weapons.get('Spellbinder'):
total_attack += super_weapon_attacks[4]
weapons['King_Bible'] -= 1
weapons['Spellbinder'] -= 1
pass1 = 1
if weapons.get('Fire_Wand') and weapons.get('Spinach'):
total_attack += super_weapon_attacks[5]
weapons['Fire_Wand'] -= 1
weapons['Spinach'] -= 1
pass1 = 1
print(total_attack) # 输出总攻击力
有时间把后面的写了,暂更。
望关注Thanks♪(・ω・)ノ