4 条题解

  • 0
    @ 2024-4-14 18:04:26
    #include<cstdio>
    #include<iostream>
    using namespace std;
    const int N=1e5+0;
    int a[N];
    
    int main(){
    	ios::sync_with_stdio(false);
    	cin.tie(0);
    	cout.tie(0);
    	int n,num;
    	cin>>n;
    	long long sumb=0,sumc=0;
    
    	for(int j=0;j<n;++j) cin>>a[j];
    	for(int j=0;j<n;++j){
    		cin>>num;
    		sumb+=a[j]*num;
    	}
    	for(int j=0;j<n;++j){
    		cin>>num;
    		sumc+=a[j]*num;
    	}
    	if(sumb>sumc) cout<<"ke";
    	else if(sumb==sumc) cout<<"same";
    	else cout<<"do";
    	return 0;
    	
    }
    
    • 0
      @ 2024-4-10 0:15:29
      #include <bits/stdc++.h>
      using namespace std;
      
      int main()
      {
          int N;
          cin >> N;
          vector<int> score(N);
          for(int i=0; i<N; i++)
              cin >> score[i];
          vector<int> sum(2,0);
          int rate;
          for(int i=0; i<2; i++)
              for(int j=0; j<N; j++)
              {
                  cin >> rate;
                  sum[i]+=score[j]*rate;//题目数据给的太仁慈了
              }
          if(sum[0]>sum[1])cout << "ke" << endl;
          else if (sum[0]<sum[1])cout << "do" << endl;
          else cout << "same" << endl;
          return 0;
      }
      
      • 0
        @ 2024-4-8 23:49:35
        #include <bits/stdc++.h>
        
        using namespace std;
        
        int main() {
            int n;
            cin >> n;
            int a[3][n];
        
            for (int i = 0; i < 3; ++i) {
                for (int j = 0; j < n; ++j) {
                    cin >> a[i][j];
                }
            }
            
            int tt = 0, xm = 0;
            for (int i = 0; i < n; ++i) {
                tt += a[0][i] * a[1][i];
                xm += a[0][i] * a[2][i];
            }
        
            if (tt > xm) {
                cout << "ke";
            } else if (tt == xm) {
                cout << "same";
            } else {
                cout << "do";
            }
        }
        
        • 0
          @ 2024-4-8 15:11:23
          #include<bits/stdc++.h>
          using namespace std;
          double tt_total=0,xm_total=0;
          int n;
          vector<int >score;
          vector<double>tt_p;
          vector<double>xm_p;
          int main()
          {
          	cin>>n;
          	for(int i=0;i<n;i++)
          	{
          		double x;
          		cin>>x;
          		score.push_back(x);
          	}
          	for(int i=0;i<n;i++)
          	{
          		double x;
          		cin>>x;
          		tt_p.push_back(x);
          	}
          	for(int i=0;i<n;i++)
          	{
          		double x;
          		cin>>x;
          		xm_p.push_back(x);
          	}
          	for(int i=0;i<n;i++)
          	{
          		tt_total+=score[i]*1.0*(tt_p[i]*1.0/100);
          		xm_total+=score[i]*1.0*(xm_p[i]*1.0/100);
          	}
          	double eps=1e-6;//精度默认定义为1e-6,当fabs(x-y)<eps时,认为x==y。 
          	if(fabs(tt_total-xm_total)<eps)cout<<"same";//fabs(x):计算x的绝对值 
          	else if(tt_total>xm_total)cout<<"ke";
          	else cout<<"do";
          	
          	return 0;
           } 
          
          • 1

          信息

          ID
          66
          时间
          1000ms
          内存
          256MiB
          难度
          7
          标签
          递交数
          250
          已通过
          57
          上传者