3 条题解
-
4
按道理这个代码没问题,64个男生11条船花费最小,再加上36个女生6条船刚好17条船
#include <bits/stdc++.h> using namespace std; int main() { int n, m, ans1 = 0, ans2 = 0, ans3 = 0; cin >> n; m = 100 - n; if (n % 6 == 1 || n % 6 == 2) { ans1 += n / 6; ans3 += 1; } else if (n % 6 == 3) { ans1 += n / 6; ans2 += 1; } else { if (n % 6 == 0) ans1 += n / 6; else ans1 += n / 6 + 1; } if (m % 6 == 1 || m % 6 == 2) { ans1 += m / 6; ans3 += 1; } else if (m % 6 == 3) { ans1 += m / 6; ans2 += 1; } else { if (m % 6 == 0) ans1 += m / 6; else ans1 += m / 6 + 1; } cout << ans1 << " " << ans2 << " " << ans3 << endl; return 0; }
-
1
#include <iostream> using namespace std; int main() { int n, m, ans1 = 0, ans2 = 0, ans3 = 0; cin >> n; m = 100 - n; if (n % 6 == 1 or n % 6 == 2) { ans1 += n / 6; ans3 += 1; } else if (n % 6 == 3) { ans1 += n / 6; ans2 += 1; } else { if (n % 6 == 0) { ans1 += n / 6; } else { ans1 += n / 6 + 1; } } if (m % 6 == 1 or m % 6 == 2) { ans1 += m / 6; ans3 += 1; } else if (m % 6 == 3) { ans1 += m / 6; ans2 += 1; } else { if (m % 6 == 0) ans1 += m / 6; else ans1 += m / 6 + 1; } cout << ans1 << " " << ans2 << " " << ans3 << endl; return 0; }
-
0
男女分别求,大于4选大船,等于3选中,小于3选小,其余全选大船
#include<bits/stdc++.h> using namespace std; int main() { int m,ans1=0,ans2=0,ans3=0; cin>>m; int w=100-m; ans1+=m/6+w/6; w=w-w/6*6,m=m-m/6*6; if (w>=4) ans1++; else if (w==3) ans2++; else if (w>0) ans3++; if (m>=4) ans1++; else if (m==3) ans2++; else if (m>0) ans3++; cout<<ans1<<" "<<ans2<<" "<<ans3; return 0; }
- 1
信息
- ID
- 341
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- 递交数
- 63
- 已通过
- 49
- 上传者