The 2024 CCPC National Invitational Contest (Northeast) ADEJ
A.PaperWatering
思路:有两种类型的操作,对一个数开根号或平方。
平方没有什么问题,开根号由于是向下取整再平方就会产生不一样的数。
那么做法也很简单了。
对于一个数
注意,如果变成了1,它将不会产生任何贡献了。
// AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 + 7; const int N = 2e5 + 10; int main() { ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); ll x,k; cin>>x>>k; if(x == 1) { cout<<1<<"\n"; return 0; } ll tmp = x; ll used = 0; ll ans = k; ll cnt = 0; while(x != 1) { cnt++; if(cnt < k && (ll)sqrt(x)*(ll)sqrt(x) != x && (ll)sqrt(x) != 1) { // cout<<"(ll)sqrt(x) = "<<(ll)sqrt(x)<<" k-cnt = "<<k-cnt<<"\n"; ans += (k-cnt); } x = (ll)sqrt(x); // cout<<"x = "<<x<<"\n"; } cout<<ans + min(cnt,k)+ 1ll<<"\n"; return 0; }
这题本身难度不大,但是写的时候还是出了问题。
一开始是认为找到第一个完全平方数就停止。其实并不是的,因为完全平方数开根之后不一定也是完全平方,所以需要看前面的所有数。
D.nIMgAME
思路:好好好,这题就充分体现了出题人的恶趣味了。一开始以为是正经博弈找规律。考虑他什么时候能赢?写了前几个之后发现,都不可能赢啊,他赢的条件实在是太难了。就想难不成永远都是lose?交一发,好好好过了。
// AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 + 7; const int N = 2e5 + 10; int main() { ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); int t; cin>>t; while(t--) { ll n; cin>>n; cout<<"lose\n"; } return 0; }
E.Checksum
思路:考虑去枚举B有i个1。总的1的个数就是
// AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 + 7; const int N = 2e5 + 10; int main() { ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); int t; cin>>t; while(t--) { ll n,k; cin>>n>>k; int cnt = 0; string s; cin>>s; for(int i = 0;i < s.size(); i++) cnt += (s[i]=='1'); string ans = "99999999999999999999"; for(int i = 0;i <= k; i++) { ll now = cnt+i;//十进制B string t = "";//二进制低k位B while(now && t.size() < k) { t += ((now&1) + '0'); now >>= 1; } for(int j = t.size();j < k; j++) t += '0'; reverse(t.begin(),t.end()); int cnt1 = count(t.begin(),t.end(),'1');//二进制B中1的个数 if(cnt1 == i) ans = min(ans,t); } if(ans == "99999999999999999999")cout<<"None\n"; else cout<<ans<<"\n"; } return 0; }
J. Breakfast
签到不多说。
// AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 + 7; const int N = 2e5 + 10; int main() { ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); double n, m; cin>>n>>m; printf("%.2lf\n",0.6*n+m); return 0; }
分类:
题解 / vp/online
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现