跳到正文

个人记录

Informatics Dream Team Biginner Contest 011 题解

why110623约 5 分钟
原文
文章信息与版本

文章信息

发布
2025年1月22日
收录
2025年12月12日
更新
2026年11月14日
篇幅
约 5 分钟

版本

  1. v1当前

A

C++
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    cout<<!n<<endl;
    return 0;
}
//祝

B

C++
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int n=s.length();
    if(s[n-1]=='s') cout<<s<<"es"<<endl;
    else cout<<s<<"s"<<endl;
    return 0;
}
//大

C

C++
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(max(a*c,a*d),max(b*c,b*d))<<endl;
    return 0;
}
//家

D

C++
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long A;
    string S;
    cin>>A>>S;
    int B=(S[0]-'0')*100+stoi(S.substr(2));
    long long ans=A*B/100;
    cout<<ans<<endl;
    return 0;
}
//新

E

C++
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a[200005];
    long long b[200]={0};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[a[i]%200]++;
    }
    long long res=0;
    for(int k=0;k<200;k++){
        res+=(b[k]*(b[k]-1))/2;
    }
    cout<<res<<endl;
    return 0;
}
//年

F

C++
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int> A(N),B(N),C(N);
    for(auto& x:A){
        cin>>x;
        x-=1;
    }
    for(auto& x:B){
        cin>>x;
        x-=1;
    }
    for(auto& x:C){
        cin>>x;
        x-=1;
    }
    vector<int> count(N);
    for(int j=0;j<N;j++){
        count[B[C[j]]]++;
    }
    long long ans=0;
    for(int i=0;i<N;i++){
        ans+=count[A[i]];
    }
    cout<<ans<<endl;
}
//快

G

C++
#include<bits/stdc++.h>
using namespace std;
#define MAXP 1000005
vector<long long> prime_list;
void c(){
    vector<bool> fl(MAXP,false);
    for(int i=2;i<MAXP;i++){
        if(fl[i]){continue;}
        prime_list.push_back(i);
        for(int j=i;j<MAXP;j+=i){fl[j]=true;}
    }
}
long long f(long long p,long long q){
    double est=1;
    est=(q*q*q);
    est*=p;
    if(est>4e18){return 4e18;}
    return p*q*q*q;
}
int main(){
    c();
    long long n;
    cin >> n;
    long long res=0;
    int sz=prime_list.size();
    int q=sz-1;
    for(int p=0;p<sz;p++){
        while(p<q && f(prime_list[p],prime_list[q])>n){q--;}
        if(p>=q){break;}
        res+=(q-p);
    }
    cout << res << '\n';
    return 0;
}
//乐
原文
存档评论1 条抓取于