1 条题解
-
0
C++ :
#include<iostream> using namespace std; int main(){ int l; cin>>l; int i,j,k; int s; s=0; for(i=1;i<=l/3;i++){ for(j=i;j<=l/2;j++){ k=l-i-j; if((k==j && j!=i) || k>j){ if(i+j>k && i+k>j && j+k>i){ s++; } } } } cout<<s<<endl; }
Python :
L=int(input()) count=0 for i in range(1,L-1): for j in range(i,L-i): k=L-i-j if (k>=j and i+j>k and i+k>j and j+k>i): if (i==j and i==k): continue else: count=count+1 print(count)
- 1
信息
- ID
- 115
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 10
- 标签
- 递交数
- 4
- 已通过
- 4
- 上传者