求助
查看原帖
求助
316827
Temperature_automata楼主2021/4/1 13:03

RT,理论分析应该无锅,但是……wa了4个点

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <bits/stdc++.h>

using namespace  std ;

int T ;


double a[4] ;
  
int main ( ) {
  // freopen("cake.in","r",stdin) ;
  // freopen("cake.out","w",stdout) ;

  cin >> T ;
  while(T--) {
    cin >> a[1] >> a[2] >> a[3] ;
    sort(a+1,a+4) ;
    if(a[1]==a[2]&&a[1]==0) {
      cout << 0 << endl ;
      continue ;
    }
    int cnt = 0 ;
    if(a[1]==0) {
      if(a[2]==a[3]) {
        cout << 1 << endl ;
        continue ;
      }
      else {
        cout << 2 << endl ;
        continue ; 
      }
    }
    if(a[1]+a[2]!=a[3]) {
      cnt += 2 ;
    }
    else cnt ++ ;
    if((a[2]==a[3])||(a[2]==abs(double(a[1]+a[2]+a[3])/2-a[3]))) {
      cout << cnt << endl ;
      continue ;
    }
    else {
      cout << cnt + 1 << endl  ;
      continue ;
    }
  }
  
  // system("pause") ;
  return 0 ;
}
2021/4/1 13:03
加载中...