標題:
2025/2/8冠毅
[打印本頁]
作者:
郭竑志
時間:
2025-2-8 14:25
標題:
2025/2/8冠毅
本帖最後由 郭竑志 於 2025-2-8 15:28 編輯
[課堂重點]
複習上次上課內容
[今日作業]
n!
2^n
作者:
郭竑志
時間:
2025-2-8 14:57
1.1+2+...+n
2.1+4+9+16+....+n*n
3.n!
4.2^n
作者:
劉冠毅
時間:
2025-2-8 15:27
#include<bits/stdc++.h>
using namespace std;
int f(int o)
{
if(o==1){
return 1;
}
return f(o-1)+o;
}
int main()
{
int u;
cin>>u;
cout<<f(u);
return 0;
}
複製代碼
作者:
劉冠毅
時間:
2025-2-8 15:35
#include<bits/stdc++.h>
using namespace std;
int f(int o)
{
if(o==1){
return 1;
}
return f(o-1)+o*o;
}
int main()
{
int u;
cin>>u;
cout<<f(u);
return 0;
}
複製代碼
作者:
劉冠毅
時間:
2025-2-21 22:37
#include<bits/stdc++.h>
using namespace std;
int f(int o)
{
if(o==1){
return 1;
}
return o*f(o-1);
}
int main()
{
int u;
cin>>u;
cout<<f(u);
return 0;
}
複製代碼
作者:
劉冠毅
時間:
2025-2-21 22:44
本帖最後由 劉冠毅 於 2025-2-22 13:40 編輯
#include<bits/stdc++.h>
using namespace std;
int f(int o)
{
if(o==1){
return 2;
}
return 2*f(o-1);
}
int main()
{
int u;
cin>>u;
cout<<f(u);
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://www.istak.org.tw/seed/)
Powered by Discuz! 7.2