6 solutions
-
2
#include<bits/stdc++.h> using namespace std; char q[246],a[8]; int front=0,rear=0; void push(char x) { if(rear<124) { q[rear]=x; rear++; } } void pop() { if(front!=rear) { front++; } } char getFront() { return q[front]; } int size() { return rear-front; } int main() { cin>>a; for(int i=0;i<strlen(a);i++) { push(a[i]); } int k=1; while(size()!=0) { if(k%2!=0) { cout<<getFront()<<" "; pop(); } else { push(getFront()); pop(); push(getFront()); pop(); } k++; } return 0; }
-
0
#include<bits/stdc++.h> using namespace std; int q[100]; int f=0,r=0; void push(int x){ q[r++]=x; } void pop(){ f++; } int fr(){ return q[f]; } int sz(){ return r-f; } int main(){ string s; cin>>s; for(int i=0;i<8;i++){ push(s[i]-'0'); } while(sz()!=0){ cout<<fr(); pop(); if(sz()==0) break; push(fr()); pop(); push(fr()); pop(); } return 0; } -
0
他们的都不行好吧 #include<bits/stdc++.h> using namespace std; char a[24],b[24]; int rear=0,front=0; void push(char x) { if(rear<24) { a[rear]=x; rear++; } } void pop() { if(front!=rear) { front++; } } char getFront() { return a[front]; } int size() { return rear-front; } int main() { cin>>b; for(int i=0;i<strlen(b);i++) { push(b[i]); } int k=1; while(size()!=0) { if(k%2!=0) { cout<<getFront(); pop(); } else { push(getFront()); pop(); push(getFront()); pop(); } k++; } return 0; }
-
0
#include<bits/stdc++.h> using namespace std; char q[24],a[8]; int front=0,rear=0; void push(char x){ if(rear<24){ q[rear]=x; rear++; } } void pop(){ if(front != rear){ front++; } } char getFront(){ return q[front]; } int size(){ return rear-front; } int main(){ cin>>a; for(int i=0;i<strlen(a);i++){ push(a[i]); } int k=1; while(size()!=0){ if(k%2!=0){ cout<<getFront(); pop(); }else{ push(getFront()); pop(); push(getFront()); pop(); } k++; } return 0; }
- 1
Information
- ID
- 2321
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 19
- Accepted
- 9
- Uploaded By