Submission #1126069
Source Code Expand
#include<iostream> #include<numeric> #include<limits> #include<cstdlib> #include<string> using namespace std; char bp[25][2]; //int fibo(int i) { // if (bp[i - 1] != numeric_limits<int>::max()/2) { // return bp[i - 1]; // } // else { // int ans; // /*if (i == 1)return 0; // else if (i == 2)return 0; // else if (i == 3)return 1;*/ // //else if (i=4) // ans = (fibo(i - 1) + fibo(i - 2) + fibo(i - 3))%10007; // bp[i - 1] = ans; // return ans; // } //} int main() { int n,c=0; char s[5] = {NULL,NULL,NULL,NULL,NULL}; //for (int i = 0; i < 1000002; ++i) { // bp[i] = numeric_limits<int>::max() / 2; //} //bp[0] = 0; //bp[1] = 0; //bp[2] = 1; //cin >> n; //ans = fibo(n); //ans = ans%10007; cin >> s; cin >> n; for (int i = 0; s[i] != NULL; i++) { for (int j = 0; s[j] != NULL; j++) { bp[c][0] = s[i]; bp[c][1] = s[j]; ++c; } } cout << bp[n - 1][0]<<bp[n-1][1]<<endl; /*for (int i = 0; i <= n;) { if(abs(bp[i]-bp[i+1])<abs(bp[i]+bp[i+2])){ i += 1; ans += abs(bp[i] - bp[i + 1]); } else if(i+2<n) { i += 2; ans += abs(bp[i] + bp[i + 2]); } else { i += 1; ans += abs(bp[i] - bp[i + 1]); } } cout << ans << endl; */ return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 25個の文字列 |
User | minkus |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 1268 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:28:39: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null] char s[5] = {NULL,NULL,NULL,NULL,NULL}; ^ ./Main.cpp:28:39: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null] ./Main.cpp:28:39: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null] ./Main.cpp:28:39: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null] ./Main.cpp:28:39: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null] ./Main.cpp:41:26: warning: NULL used in arithmetic [-Wpointer-arith] for (int i = 0; s[i] != NULL; i++) { ^ ./Main.cpp:42:27: warning: NULL used in arithmetic [-Wpointer-arith] for (int j = 0; s[j] != NULL; j++) { ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt |
All | sample-01.txt, sample-02.txt, sample-03.txt, test-01.txt, test-02.txt, test-03.txt, test-04.txt, test-05.txt, test-06.txt, test-07.txt, test-08.txt, test-09.txt, test-10.txt, test-11.txt, test-12.txt, test-13.txt, test-14.txt, test-15.txt, test-16.txt, test-17.txt, test-18.txt, test-19.txt, test-20.txt, test-21.txt, test-22.txt, test-23.txt, test-24.txt, test-25.txt, test-26.txt, test-27.txt, test-28.txt, test-29.txt, test-30.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample-01.txt | AC | 1 ms | 256 KB |
sample-02.txt | AC | 1 ms | 256 KB |
sample-03.txt | AC | 1 ms | 256 KB |
test-01.txt | AC | 1 ms | 256 KB |
test-02.txt | AC | 1 ms | 256 KB |
test-03.txt | AC | 1 ms | 256 KB |
test-04.txt | AC | 1 ms | 256 KB |
test-05.txt | AC | 1 ms | 256 KB |
test-06.txt | AC | 1 ms | 256 KB |
test-07.txt | AC | 1 ms | 256 KB |
test-08.txt | AC | 1 ms | 256 KB |
test-09.txt | AC | 1 ms | 256 KB |
test-10.txt | AC | 1 ms | 256 KB |
test-11.txt | AC | 1 ms | 256 KB |
test-12.txt | AC | 1 ms | 256 KB |
test-13.txt | AC | 1 ms | 256 KB |
test-14.txt | AC | 1 ms | 256 KB |
test-15.txt | AC | 1 ms | 256 KB |
test-16.txt | AC | 1 ms | 256 KB |
test-17.txt | AC | 1 ms | 256 KB |
test-18.txt | AC | 1 ms | 256 KB |
test-19.txt | AC | 1 ms | 256 KB |
test-20.txt | AC | 1 ms | 256 KB |
test-21.txt | AC | 1 ms | 256 KB |
test-22.txt | AC | 1 ms | 256 KB |
test-23.txt | AC | 1 ms | 256 KB |
test-24.txt | AC | 1 ms | 256 KB |
test-25.txt | AC | 1 ms | 256 KB |
test-26.txt | AC | 1 ms | 256 KB |
test-27.txt | AC | 1 ms | 256 KB |
test-28.txt | AC | 1 ms | 256 KB |
test-29.txt | AC | 1 ms | 256 KB |
test-30.txt | AC | 1 ms | 256 KB |