Submission #1688668
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define REP(i, s, n) for (int i = s; i < n; ++i) #define rep(i, n) REP(i, 0, n) #define SORT(c) sort((c).begin(), (c).end()) #define IINF INT_MAX #define LLINF LLONG_MAX #define DEBUG true // sort(a.begin(), a.end(), std::greater<int>()); /* std::vector<std::string> split(const std::string &input, char delimiter) { std::istringstream stream(input); std::string field; std::vector<std::string> result; while (std::getline(stream, field, delimiter)) { result.push_back(field); } return result; } */ int main() { string str; cin >> str; int foo = (int)pow(2, str.length() - 1); long long int ans = 0; if (str.length() == 1) cout << (int)(str[0] - '0') << endl; vector<string> cut; REP(i, 1, foo) { int start = 0; cut.clear(); REP(j, 0, str.length()) { if (i & 1 << j) { string hoge = str.substr(start, 1+j - start); cut.push_back(hoge); start = j+1; } } cut.push_back(str.substr(start)); rep(j, cut.size()) { ans+=stoi(cut[j]); } cout<<endl; } cout<<ans+stoi(str)<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Many Formulas |
User | ToM_ynu |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1354 Byte |
Status | RE |
Exec Time | 116 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status | AC |
|
Set Name | Test Cases |
---|---|
Sample | |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, sample_01.txt, sample_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | RE | 116 ms | 640 KB |
02.txt | AC | 2 ms | 256 KB |
03.txt | RE | 106 ms | 256 KB |
04.txt | WA | 1 ms | 256 KB |
05.txt | AC | 2 ms | 256 KB |
06.txt | AC | 2 ms | 256 KB |
07.txt | RE | 108 ms | 256 KB |
08.txt | AC | 2 ms | 256 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 1 ms | 256 KB |
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | RE | 107 ms | 256 KB |