提出 #68915946
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll dp[15];
string a[1005];
ll f(ll s){
string a="";
if(s%10==0)s/=10;
while(s!=0){
a+=s%10+'0';
s/=10;
}
s=0;
for(int i=0;i<a.size();i++){
s*=10;
s+=a[i]-'0';
}
return s;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>dp[1]>>dp[2];
for(int i=3;i<=10;i++){
dp[i]=f(dp[i-1]+dp[i-2]);
}
cout<<dp[10];
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Fibonacci Reversed |
| ユーザ | a_little_cat |
| 言語 | C++ 20 (gcc 12.2) |
| 得点 | 200 |
| コード長 | 474 Byte |
| 結果 | AC |
| 実行時間 | 2 ms |
| メモリ | 3636 KiB |
コンパイルエラー
Main.cpp: In function ‘ll f(ll)’:
Main.cpp:14:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
14 | for(int i=0;i<a.size();i++){
| ~^~~~~~~~~
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3436 KiB |
| 00_sample_01.txt | AC | 1 ms | 3432 KiB |
| 00_sample_02.txt | AC | 1 ms | 3508 KiB |
| 01_random_00.txt | AC | 1 ms | 3508 KiB |
| 01_random_01.txt | AC | 1 ms | 3500 KiB |
| 01_random_02.txt | AC | 1 ms | 3504 KiB |
| 01_random_03.txt | AC | 1 ms | 3424 KiB |
| 01_random_04.txt | AC | 1 ms | 3516 KiB |
| 01_random_05.txt | AC | 1 ms | 3444 KiB |
| 01_random_06.txt | AC | 1 ms | 3568 KiB |
| 01_random_07.txt | AC | 2 ms | 3636 KiB |
| 02_handmade_00.txt | AC | 1 ms | 3368 KiB |
| 02_handmade_01.txt | AC | 1 ms | 3512 KiB |
| 02_handmade_02.txt | AC | 1 ms | 3500 KiB |
| 02_handmade_03.txt | AC | 1 ms | 3496 KiB |
| 02_handmade_04.txt | AC | 1 ms | 3492 KiB |