標題:
a272. 猥瑣罐頭下樓梯
[打印本頁]
作者:
李知易
時間:
昨天 00:18
標題:
a272. 猥瑣罐頭下樓梯
本帖最後由 李知易 於 2025-2-22 00:29 編輯
[attach]20671[/attach]
本帖隱藏的內容需要回復才可以瀏覽
作者:
高鋐鈞
時間:
昨天 10:53
#include<bits/stdc++.h>
using namespace std;
long long DP[20017]={0};
long long f(int a){
if(a==1){
return DP[1]=1;
}if(a==2){
return DP[2]=2;
}if(DP[a]){
return DP[a];
}else{
return DP[a]= (f(a-1)+f(a-2))%10007;
}
}
int main()
{
int a=0;
while(cin>>a){
a=a%20016;
cout<<f(a)<<endl;
}
return 0;
}
複製代碼
作者:
洪承廷
時間:
昨天 11:00
本帖最後由 洪承廷 於 2025-2-22 11:03 編輯
#include<bits/stdc++.h>
using namespace std;
int b[20017];
int compute(int a)
{
if(a==1)
return 1;
else if(a==2)
return 2;
if(b[a])
{
return b[a];
}
else
{
return b[a]=(compute(a-1)+compute(a-2))%10007;
}
}
int main()
{
int a;
while(cin>>a)
{
cout<<compute(a%20016)<<endl;
}
return 0;
}
複製代碼
作者:
張駿霖
時間:
昨天 11:23
#include<bits/stdc++.h>
using namespace std;
long long DP[20017]={0};
long long f(int a){
if(n==1){
return DP[1]=1;
}if(n==2){
return DP[2]=2;
}if(DP[n]){
return DP[n];
}else{
return DP[n]= (f(n-1)+f(n-2))%10007;
}
}
int main()
{
int n=0;
while(cin>>n){
n=n%20016;
cout<<f(n)<<endl;
}
return 0;
}
複製代碼
作者:
楊惇翔
時間:
昨天 12:00
#include <bits/stdc++.h>
using namespace std;
long long int DP[20017]={0};
long long int compute(int a)
{
if(a==1)
return DP[1] = 1;
if(a==2)
return DP[2] = 2;
if(DP[a])
return DP[a];
else
return DP[a]=(compute(a-2)+compute(a-1))%10007;
}
int main()
{
int n;
while(cin>>n)
{
n=n%20016;
cout<<compute(n)<<endl;
}
return 0;
}#include <bits/stdc++.h>
using namespace std;
long long int DP[20017]={0};
long long int compute(int a)
{
if(a==1)
return DP[1] = 1;
if(a==2)
return DP[2] = 2;
if(DP[a])
return DP[a];
else
return DP[a]=(compute(a-2)+compute(a-1))%10007;
}
int main()
{
int n;
while(cin>>n)
{
n=n%20016;
cout<<compute(n)<<endl;
}
return 0;
}
複製代碼
作者:
孫子傑
時間:
昨天 12:03
#include<bits/stdc++.h>
using namespace std;
int main() {
string str;
getline(cin,str);
int space=0;
for(int i=0;i<str.length();i++)
{
if(str[i]==' ')
{
space++;
}
if(str[i]!=' ')
{
if(space%2!=0)
{
cout<<" ";
}
cout<<str[i];
space=0;
}
}
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2