当前位置: 首页> 文旅> 酒店 > python编程语言的特点_惠州网站建设咨询_百度seo推广软件_sem竞价专员是干什么的

python编程语言的特点_惠州网站建设咨询_百度seo推广软件_sem竞价专员是干什么的

时间:2025/7/13 19:22:41来源:https://blog.csdn.net/song0789/article/details/143133350 浏览次数:0次
python编程语言的特点_惠州网站建设咨询_百度seo推广软件_sem竞价专员是干什么的

比赛地址:牛客竞赛_ACM/NOI/CSP/CCPC/ICPC算法编程高难度练习赛_牛客竞赛OJ


A.小红的对错判断

#include<bits/stdc++.h>
using namespace std;
#define ll long long  
#define ull unsigned long longvoid solve() {string ssr;cin>>ssr;int a=ssr.length();if(a==3){if(ssr[0]=='y'||ssr[0]=='Y'){if(ssr[1]=='e'||ssr[1]=='E'){if(ssr[2]=='s'||ssr[2]=='S'){cout<<"accept"<<endl;return;}}}}cout<<"wrong answer"<<endl;
} signed main() {ios::sync_with_stdio(0);cout.tie(0);cin.tie(0);ll t = 1; // std::cin >> t;while (t--) {solve();}
}


B.小红的幂表达

#include <bits/stdc++.h>
using namespace std;int main() {ios::sync_with_stdio(false);cin.tie(nullptr);int x;cin >> x;cout << x << endl;cout<<"="<<x<<"^1"<<endl;for(int i=sqrt(x);i>=2;i--){int sum=0;int j=x;while(1){if(j%i==0){j/=i;sum++;if(j==1){cout<<"="<<i<<"^"<<sum<<endl;break;}}else{break;}}}return 0;
}


C.小红的前缀询问

#include <bits/stdc++.h>
using namespace std;int main() {ios::sync_with_stdio(false);cin.tie(nullptr);int n;cin >> n;vector<long long int> a(n);for (int i = 0; i < n; ++i) {cin >> a[i];}unordered_map<long long int, int> ssr;long long int pairCount = 0;vector<long long int> result(n);for (int i = 0; i < n; ++i) {ssr[a[i]]++;int newPairs = ssr[a[i]] - 1;pairCount += newPairs;result[i] = pairCount;}for (int i = 0; i < n-1; ++i) {cout << result[i] <<" ";}cout << result[n-1];return 0;
}


D.红和小紫的博弈游戏

#include <bits/stdc++.h>
using namespace std;void solve() {long long int a, b, c, d;cin >> a >> b >> c >> d;long long int totalSum = a + b + c + d;if (totalSum == 0||totalSum==1) {cout << "yukari" << endl;return;}int x=a+d;int y=b+c;x=min(x,y);if(x%2){cout << "kou" << endl;}else{cout << "yukari" << endl;}}int main() {ios::sync_with_stdio(false);cin.tie(nullptr);int t;cin >> t;while (t--) {solve();}return 0;
}

关键字:python编程语言的特点_惠州网站建设咨询_百度seo推广软件_sem竞价专员是干什么的

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: