4 条题解

  • 3
    @ 2026-2-4 20:56:49

    T20 数数题解

    目前不知道为什么这么水的题难度这么高

    第一步:取消cin与C语言输入scanf()的流同步,加速输入。

    第二步:依题意输入 a,b,c,d,ea,b,c,d,e

    第三步(暴力):利用大量 ifif 语句以及与条件(&&),不等于(!=)判定。

    第四步:输出答案。

    上代码:

    #include<bits/stdc++.h>
    using namespace std;
    
    int a, b, c, d, e;
    int ans=1;
    
    signed main() {
    	cin.tie(nullptr)->ios::sync_with_stdio(false);
    	cin >> a >> b >> c >> d >> e;
    	if (a != b && a != c && a != d && a != e) ans++;
    	if (b != c && b != d && b != e)ans++;
    	if (c != d && c != e)ans++;
    	if (d != e)ans++;
    	cout<<ans<<'\n';
    	
    }
    

    @20250001 给我硬币

    • @ 2026-5-8 13:06:58

      感觉你的好复杂 (我都看不懂)

      #include <iostream>
      using namespace std;
      int main(){
          int a[6],b=5;
          for(int i=1;i<=5;i++){
              cin>>a[i];
          }
          for(int i=1;i<=4;i++){
          	for(int j=i+1;j<=5;j++){
          		if(a[i]==a[j]) {
          			b-=1;
          			break;
      			}
          		
      		}
              
          }
          cout<<b<<endl;
          return 0;
      }
      
      

      你看看我的

    • @ 2026-5-21 20:36:39

      这个这个

      #include <iostream>
      using namespace std;
      int main() {
      int a[5];
      for (int i = 0; i < 5; i++) {
          cin >> a[i];
      }
      
      int cnt = 0; 
      
      
      for (int i = 0; i < 5; i++) {
          bool unique = true;
          for (int j = i + 1; j < 5; j++) {
              if (a[i] == a[j]) {
                  unique = false;
                  break;
              }
          }
          if (unique) cnt++;
      }
      
      cout << cnt << endl;
      return 0;
      }
      

信息

ID
20
时间
1000ms
内存
256MiB
难度
1
标签
递交数
462
已通过
123
上传者