Re-translate the Japanese version (#1871)

* Retranslate Japanese docs with GPT-5.4

* Retranslate Japanese code with GPT-5.4
This commit is contained in:
Yudong Jin
2026-03-30 07:30:15 +08:00
committed by GitHub
parent fe6443235b
commit d7b2277d2b
1444 changed files with 83312 additions and 8363 deletions

View File

@@ -8,16 +8,16 @@
/* 最大容量:貪欲法 */
int maxCapacity(vector<int> &ht) {
// ij を初期化し、配列の両端で分割させる
// i, j を初期化し、それぞれ配列の両端に置く
int i = 0, j = ht.size() - 1;
// 初期最大容量は 0
// 初期最大容量は 0
int res = 0;
// 2の板が出会うまで貪欲選択をループ
// 2の板が出会うまで貪欲選択を繰り返す
while (i < j) {
// 最大容量を更新
// 最大容量を更新する
int cap = min(ht[i], ht[j]) * (j - i);
res = max(res, cap);
// より短いを内側に移動
// 短いを内側へ動かす
if (ht[i] < ht[j]) {
i++;
} else {
@@ -27,13 +27,13 @@ int maxCapacity(vector<int> &ht) {
return res;
}
/* ドライバーコード */
/* Driver Code */
int main() {
vector<int> ht = {3, 8, 5, 2, 7, 7, 3, 4};
// 貪欲アルゴリズム
// 貪欲
int res = maxCapacity(ht);
cout << "最大容量は " << res << " です" << endl;
cout << "最大容量は " << res << endl;
return 0;
}
}