Download spoj_cpp_clean/ACODE/ACODE-5.cpp from slayone/uva_spoj_raw: direct link, hf CLI and curl.
- Browser
- Download file 778 Bytes
-
https://huggingface.co/datasets/slayone/uva_spoj_raw/resolve/main/spoj_cpp_clean/ACODE/ACODE-5.cpp
- Command line
-
hf download hf://datasets/slayone/uva_spoj_raw/spoj_cpp_clean/ACODE/ACODE-5.cpp
-
curl -L -o ACODE-5.cpp https://huggingface.co/datasets/slayone/uva_spoj_raw/resolve/main/spoj_cpp_clean/ACODE/ACODE-5.cpp
778 Bytes
| // Evaluate for "226210", other than that the code is self explanatory | |
| using namespace std; | |
| map<int, long long>dp; | |
| int main() | |
| { | |
| string input; | |
| int i,strLength; | |
| cin>>input; | |
| while(input[0]!='0') | |
| { | |
| strLength=input.length(); | |
| dp[0]=1; | |
| dp[1]=1; | |
| for(i=1;i<strLength;i++) | |
| { | |
| if(input[i]!='0') | |
| { | |
| if(input[i-1]!='0'&&(input[i-1]-48)*10+(input[i]-48)<=26) | |
| { | |
| dp[i+1]=dp[i]+dp[i-1]; | |
| } | |
| else | |
| dp[i+1]=dp[i]; | |
| } | |
| else | |
| dp[i+1]=dp[i-1]; | |
| } | |
| cout<<dp[i]<<endl; | |
| cin>>input; | |
| } | |
| return 0; | |
| } | |