#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
while (cin >> n){
int a[n];
for (int i=0; i<n; i++){
a[i]=i+1;
}
int sum=0;
while (a[0]!=0){
int b=0;
n=a[n/2];
for (int j=0; j<n; j++){
if (a[j]>=n){
a[j]=a[j]-n;
b=1;
}
}
if (b==1){
sum++;
}
}
cout << sum << '\n';
}
return 0;
}
#includeusing namespace std;
int main()
{
int n;
while (cin >> n){
int a[n];
for (int i=0; i
a[i]=i+1;
}
int sum=0;
while (a[0]!=0){
int b=0;
n=a[n/2];
for (int j=0; j
if (a[j]>=n){
a[j]=a[j]-n;
b=1;
}
}
if (b==1){
sum++;
}
}
cout << sum << '\n';
}return 0;
}
n (0 <= n <= 10^18)
#includeusing namespace std;
int main()
{
int n;
while (cin >> n){
int a[n];
for (int i=0; i
a[i]=i+1;
}
int sum=0;
while (a[0]!=0){
int b=0;
n=a[n/2];
for (int j=0; j
if (a[j]>=n){
a[j]=a[j]-n;
b=1;
}
}
if (b==1){
sum++;
}
}
cout << sum << '\n';
}return 0;
}n (0 <= n <= 10^18)
又是你欸!
謝謝大神指教🙏
#includeusing namespace std;
int main()
{
int n;
while (cin >> n){
int a[n];
for (int i=0; i
a[i]=i+1;
}
int sum=0;
while (a[0]!=0){
int b=0;
n=a[n/2];
for (int j=0; j
if (a[j]>=n){
a[j]=a[j]-n;
b=1;
}
}
if (b==1){
sum++;
}
}
cout << sum << '\n';
}return 0;
}n (0 <= n <= 10^18)
#includeusing namespace std;
int main()
{
int n;
while (cin >> n){
int a[n];
for (int i=0; i
a[i]=i+1;
}
int sum=0;
while (a[0]!=0){
int b=0;
n=a[n/2];
for (int j=0; j
if (a[j]>=n){
a[j]=a[j]-n;
b=1;
}
}
if (b==1){
sum++;
}
}
cout << sum << '\n';
}return 0;
}n (0 <= n <= 10^18)
所以我應該用vector嗎
#includeusing namespace std;
int main()
{
int n;
while (cin >> n){
int a[n];
for (int i=0; i
a[i]=i+1;
}
int sum=0;
while (a[0]!=0){
int b=0;
n=a[n/2];
for (int j=0; j
if (a[j]>=n){
a[j]=a[j]-n;
b=1;
}
}
if (b==1){
sum++;
}
}
cout << sum << '\n';
}return 0;
}n (0 <= n <= 10^18)
所以我應該用vector嗎
還是有什麼好方法
#includeusing namespace std;
int main()
{
int n;
while (cin >> n){
int a[n];
for (int i=0; i
a[i]=i+1;
}
int sum=0;
while (a[0]!=0){
int b=0;
n=a[n/2];
for (int j=0; j
if (a[j]>=n){
a[j]=a[j]-n;
b=1;
}
}
if (b==1){
sum++;
}
}
cout << sum << '\n';
}return 0;
}n (0 <= n <= 10^18)
所以我應該用vector嗎
還是有什麼好方法
數論題吧,I don't know,寫別題ㄅ