- 问答
智慧数
- 2024-1-3 16:10:31 @
#include <bits/stdc++.h>
using namespace std;
int main()
{
int y,s,j,a;
long long n;
cin >> n;
if(n==1 & n==2 & n==3)
{
if(n==1) cout<<3<<endl;
if(n==2)cout<<5<<endl;
if(n==3) cout<<7<<endl;
}
else
{
a = n-3;
y = a % 3;
s = a / 3;
if (y==2) j=1;
if (y==3) j=3;
cout << 4*s + j <<endl;
}
return 0;
}
//3 5 7 bs
//8 9 11
//12 13 15
//16 17 19
//20 21 23
//24 25 27
错哪了
5 comments
-
经开一中2026届11班关泽瑞 LV 6 @ 2024-1-3 21:01:56
做题进化史😅
-
2024-1-3 17:12:04@
#include <bits/stdc++.h> using namespace std; int main() { int y,s,j,a; int n; cin >> n; if(n==1 || n==2 || n==3) { if(n==1) cout<<3<<endl; if(n==2)cout<<5<<endl; if(n==3) cout<<7<<endl; } else { a = n-3; //cout << a <<endl; s = n / 3; //s++; //if (s==0) s=1; //cout << s+1 << "组" <<endl; //cout << s << "组" <<endl; y = a % 3; //cout << "第" << y << "个"<<endl; if (y==1) j=0; if (y==2) j=1; if (y==0) j=-1; //cout <<"加"<< j <<endl; cout << 4*(s+1) + j <<endl; } return 0; } //3 5 7 bs //8 9 11 //12 13 15 //16 17 19 //20 21 23 //24 25 27
改好了改好了,谢谢同学老师和c++
-
2024-1-3 16:39:18@
#include <bits/stdc++.h> using namespace std; int main() { int y,s,j,a; int n; cin >> n; if(n==1 || n==2 || n==3) { if(n==1) cout<<3<<endl; if(n==2)cout<<5<<endl; if(n==3) cout<<7<<endl; } else { a = n-3; cout << a <<endl; s = n / 3; //s++; //if (s==0) s=1; //cout << s+1 << "组" <<endl; cout << s << "组" <<endl; y = a % 3; cout << "第" << y << "个"<<endl; if (y==1) j=0; if (y==2) j=1; if (y==0) j=3; cout <<"加"<< j <<endl; cout << 4*(s+1) + j <<endl; } return 0; } //3 5 7 bs //8 9 11 //12 13 15 //16 17 19 //20 21 23 //24 25 27
第三版,答案对了,提交有问题 (已经注释辅助代码)
-
2024-1-3 16:22:35@
#include <bits/stdc++.h> using namespace std; int main() { int y,s,j,a; int n; cin >> n; if(n==1 || n==2 || n==3) { if(n==1) cout<<3<<endl; if(n==2)cout<<5<<endl; if(n==3) cout<<7<<endl; } else { a = n-3; cout << a <<endl; s = a / 3; s++; //if (s==0) s=1; cout << s+1 << "组" <<endl; y = a % 4; cout << "第" << y << "个"<<endl; if (y==1) j=0; if (y==2) j=1; if (y==3) j=3; cout <<"加"<< j <<endl; cout << 4*(s+1) + j <<endl; } return 0; } //3 5 7 bs //8 9 11 //12 13 15 //16 17 19 //20 21 23 //24 25 27 //3 5 7 bs //8 9 //11 12 13 //15 16 17 //19 20 21 //23 24 25
改了改了,还是差点
-
2024-1-3 16:20:20@
发题号😕
- 1