Task: | Merkkijono |
Sender: | luxask |
Submission time: | 2017-10-06 19:50:42 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.04 s | details |
#2 | ACCEPTED | 0.05 s | details |
#3 | ACCEPTED | 0.04 s | details |
#4 | WRONG ANSWER | 0.04 s | details |
#5 | WRONG ANSWER | 0.05 s | details |
#6 | WRONG ANSWER | 0.04 s | details |
#7 | WRONG ANSWER | 0.04 s | details |
#8 | WRONG ANSWER | 0.05 s | details |
#9 | WRONG ANSWER | 0.04 s | details |
#10 | WRONG ANSWER | 0.04 s | details |
Code
#include <iostream> #include <vector> #include <math.h> using namespace std; vector<int> getIndexes() { int count, num; vector<int> indexes; cin >> count; for (int i = 0; i < count; ++i) { cin >> num; indexes.push_back(num); } return indexes; } int f(int x) { return 9 * x * pow(10, x-1); } int getFirstNumber(int index, int numCount) { return floor(index / (numCount * 10)) + 1; } int getMiddleNumber(int index, int numCount, int subNumber) { return floor(floor(index / numCount) / pow(10, numCount - subNumber)); } int getLastNumber(int index, int numCount) { return ((index / numCount) - 1) % 10; } int getNumberFromIndex(int index) { if (index <= 9) return index; int numCount = 1; while (index >= f(numCount)) { index -= f(numCount); numCount++; } switch (int subNumber = index % numCount){ case 0: return getLastNumber(index, numCount); break; case 1: return getFirstNumber(index, numCount); break; default: return getMiddleNumber(index, numCount, subNumber); break; } } void fake() { for (unsigned i=1; i<50; i++) cout << getNumberFromIndex(i); } void real() { auto indexes = getIndexes(); for (unsigned i=0; i<indexes.size(); i++) cout << getNumberFromIndex(indexes.at(i)) << '\n'; } int main() { real(); return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
ABABABABABABABABABABABABABABAB... |
correct output |
---|
ABABABABABABABABABABABABABABAB... |
user output |
---|
(empty) |
Test 2
Verdict: ACCEPTED
input |
---|
AABBAABBAABBAABBAABBAABBAABBAA... |
correct output |
---|
(empty) |
user output |
---|
(empty) |
Test 3
Verdict: ACCEPTED
input |
---|
ABABABABABABABABABABABABABABAB... |
correct output |
---|
(empty) |
user output |
---|
(empty) |
Test 4
Verdict: WRONG ANSWER
input |
---|
BBABABBBBBAABBBABABABBBBAAABAB... |
correct output |
---|
BAB |
user output |
---|
(empty) |
Test 5
Verdict: WRONG ANSWER
input |
---|
ACDCBBACDBBBACAACBBDBADBAABABA... |
correct output |
---|
ACDCACDADBADABACACDCADADABABCA... |
user output |
---|
(empty) |
Test 6
Verdict: WRONG ANSWER
input |
---|
EETFHIJOGACDHMGVFJCMETMZDEITTR... |
correct output |
---|
TFHIJOGACDHMGVFJCMETMZDEIROTET... |
user output |
---|
(empty) |
Test 7
Verdict: WRONG ANSWER
input |
---|
GOONLAHLYPRFCZKIKSJWAWWYJJPCDB... |
correct output |
---|
GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE... |
user output |
---|
(empty) |
Test 8
Verdict: WRONG ANSWER
input |
---|
PISHWMOTCDDZFRMYMOMYDYYGJZIQHS... |
correct output |
---|
PISHWMOTCZFRMYMOMYDGJZIQHSVAOK... |
user output |
---|
(empty) |
Test 9
Verdict: WRONG ANSWER
input |
---|
QUVVTPXAMWWODFXRONJODPGBTCISGM... |
correct output |
---|
QUTPXAMODFXRONJODPGBTCISGMVRBW... |
user output |
---|
(empty) |
Test 10
Verdict: WRONG ANSWER
input |
---|
POXHAHYEZTLYNFSLABODMRNKDSKROZ... |
correct output |
---|
POXHAHYEZTLYNFSLABODMRNKDSKROZ... |
user output |
---|
(empty) |