当前位置: 首页 > news >正文

2025年河南工业大学2025新生周赛(2)

A 小唐的签到

小唐到达教室的时间等于路上所用时间和上楼时间之和,注意如果教室在n楼,只需要上n-1层。

#include<bits/stdc++.h>
using namespace std;
int main()
{int a, x, n, b, y;cin >> a >> x >> n >> b >> y;long long res = (x + a - 1) / a + (n - 1) * b;if (y >= res) cout << "qiandao";else cout << "bu";return 0;
}

B 小唐的日历

注意闰年

#include <bits/stdc++.h>  
#define int long long
#define inf 1e18
#define maxn 400005
using namespace std;
int const mod = 998244353;
void solve()
{int n, m; cin >> n >> m;int r = (n % 400 == 0) || (n % 4 == 0 && n % 100 != 0);// switch针对月份分支,直接输出对应天数switch (m) {case 1: case 3: case 5: case 7: case 8: case 10: case 12:cout << 31; break;case 4: case 6: case 9: case 11:cout << 30; break;case 2:cout << (r ? 29 : 28);break;}return;
}
signed main()
{ios::sync_with_stdio(false);cin.tie(0);//          int t; cin >> t;//          while (t--)
    solve();return 0;
}

C 小唐的密码

n次循环录入字符,并进行移动后依次输出。

#include <bits/stdc++.h>  
using namespace std;
signed main()
{int n; cin >> n;getchar();char s;while (scanf("%c", &s)){if (s >'z' ||s<'a') break;int a = s - 'a';a += n;a %= 26;char m = char(a + 'a');cout << m;}return 0;
}

D 小唐的运气

(a-b)*t > x 时能追上。

#include <bits/stdc++.h>  
using namespace std;
signed main()
{int x, a, b, t;cin >> x >> a >> b >> t;if ((a - b) * t >= x){cout << "yes" << endl;return;}else cout << "no" << endl;return 0;
}

 

E 小唐的真名

循环遍历,匹配字符。

#include <bits/stdc++.h>
using namespace std;
signed main() {int n; cin >> n;if (n < 7) { cout << "no\n"; return 0; }char t0 = 's', t1 = 'a', t2 = 'n', t3 = 'g', t4 = 'q', t5 = 'i', t6 = 'u';int k = 0; char c;for (int i = 0; i < n; i++) {cin >> c;switch (k) {case 0:c == t0 && (k = 1); break;case 1:c == t1 ? k = 2 : (k = c == t0 ? 1 : 0); break;case 2:c == t2 ? k = 3 : (k = c == t0 ? 1 : 0); break;case 3:c == t3 ? k = 4 : (k = c == t0 ? 1 : 0); break;case 4:c == t4 ? k = 5 : (k = c == t0 ? 1 : 0); break;case 5:c == t5 ? k = 6 : (k = c == t0 ? 1 : 0); break;case 6:if (c == t6) { cout << "yes\n"; return 0; }else k = c == t0 ? 1 : 0; break;}}//会使用数组的话,可以减少大量码量。cout << "no\n"; return 0;
}

F 小唐的工作

n天完成的任务量可以简化为1-pow(0.5,n+1)。

#include <bits/stdc++.h>  
using namespace std;
signed main()
{int n;cin >> n;double x = pow(0.5, n);printf("%.18lf", 1-x);return 0;
}

G 小唐的饼干

从第n天,每往前一天需要先加二再乘二,注意每中间数可能会很大,每一步运算都需要对114取模。

#include <bits/stdc++.h>  
using namespace std;
int const mod = 114;
signed main()
{int n; cin >> n;n--;int re = 1;while (n--) re = ((re + 2) * 2) % mod;cout << re;return 0;
}

H 小唐的升级

先计算获得的经验总和,在计算提升的等级。

#include <bits/stdc++.h>  
using namespace std;
signed main()
{int x, y, n; cin >> x >> y >> n;int m = y * n;int re = 0;while (m >= x){m -= x;x *= 2;re++;}cout << re << endl;return 0;
}

 

http://www.gsyq.cn/news/40140.html

相关文章:

  • Reflections on Trusting Trust by Ken Thompson
  • [Agent] ACE(Agentic Context Engineering)源码阅读笔记---(1)基础模块
  • 顺序结构及选择结构
  • 洛谷 P10894
  • 服务器取证基本知识学习
  • 实用指南:【18】C实战篇——C语言 文件读写【fputc、fgetc、fputs、fgets】
  • L09_ java内注解反射的简单理解(作为小白,菜鸟的理解)
  • 20232323 2024-2025-1《网络与系统攻防技术》实验4实验报告
  • 直播带货话术不会写?这个AI指令帮你搞定
  • Java数组——数组的使用
  • NOIP2025加训
  • 20232427 2025-2026-1 《网络与系统攻防技术》实验四实验报告
  • Windows 系统下通过 VMware 17 安装 macOS 的教程
  • 2025.11.4 - A
  • 移动通信基站
  • kaggle提交 名字不是submission.csv的提交方法
  • NOIP2025 游记
  • 【学习笔记】kafka权威指南——第3章 kafka生产者—向kafka写入资料
  • 软工团队第一次作业
  • VS 2017 项目文件不完整,缺少预期导入
  • 人性的弱点
  • 机器学习基础入门(第四篇):无监督学习与聚类途径
  • 程序员必逛的9个开发者社区推荐
  • CleanMyMac X 4.14.2 dmg 安装教程|Mac 清理软件详细安装步骤
  • 某大厂跳动面试:计算机网络相关问题解析与总结 - 教程
  • AI元人文:悟空机制与反思——论智能文明的自我超越之道
  • 实用指南:Python 运算符与列表(list)
  • 接口请求测试题目
  • iOS - 从 @property 开始
  • 使用涡流效应将伽马射线收集到一起的装置