Accepted
/in/foo.cc: In function 'int main()': /in/foo.cc:9:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0; i<code.length(); i++) ~^~~~~~~~~~~~~~
# | 状态 | 耗时 | 内存占用 |
---|
/in/foo.cc: In function 'int main()': /in/foo.cc:9:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0; i<code.length(); i++) ~^~~~~~~~~~~~~~
# | 状态 | 耗时 | 内存占用 |
---|
#include<bits/stdc++.h>
using namespace std;
char arr[3005];
char* p = arr+1500;
int main()
{
string code; getline(cin,code);
for(int i=0; i<code.length(); i++)
{
char c = code[i];
if(c == '+') (*p)++;
if(c == '-') (*p)--;
if(c == '>') p++;
if(c == '<') p--;
if(c == '.') putchar(*p);
if(c == ',') *p = getchar();
if(c == '[') if(!(*p)) while(code[i]!=']') {i++;}
if(c == ']') if(*p) do{i--;} while(code[i]!='[');
}
return 0;
}