Download uva_cpp_clean/10013/10013-19.cpp from slayone/uva_spoj_raw: direct link, hf CLI and curl.
- Browser
- Download file 653 Bytes
-
https://huggingface.co/datasets/slayone/uva_spoj_raw/resolve/main/uva_cpp_clean/10013/10013-19.cpp
- Command line
-
hf download hf://datasets/slayone/uva_spoj_raw/uva_cpp_clean/10013/10013-19.cpp
-
curl -L -o 10013-19.cpp https://huggingface.co/datasets/slayone/uva_spoj_raw/resolve/main/uva_cpp_clean/10013/10013-19.cpp
653 Bytes
| using namespace std; | |
| int main() { | |
| int N; | |
| cin >> N; | |
| while (N--) { | |
| int M; | |
| cin >> M; | |
| vector<char> v1(M), v2(M); | |
| for (int i = 0; i < M; i++) { | |
| cin >> v1[i] >> v2[i]; | |
| } | |
| bool carry = false; | |
| for (int i = M - 1; i >= 0; i--) { | |
| int val = v1[i] + v2[i] - '0' - '0'; | |
| if (carry) val++; | |
| v1[i]= val%10 + '0'; | |
| carry = val >= 10; | |
| } | |
| if (carry) printf("1"); | |
| for (int i = 0; i < M; i++) printf("%c", v1[i]); | |
| printf("\n"); | |
| if (N) printf("\n"); | |
| } | |
| return 0; | |
| } | |