Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
lightoj - 1113 - Discover the Web
jakaria_hossain
Aug 21st, 2019
106
Never
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
C++
1.60 KB
raw
download
clone
embed
print
report
RAW Paste Data
#include<bits/stdc++.h> using namespace std; #define fast()(ios_base::sync_with_stdio(false),cin.tie(NULL)); stack<string>f,b; int turn; string choice,url; void next() { if(choice=="VISIT") turn=0; if(choice=="FORWARD") turn = 1; if(choice=="BACK") turn =2; } int main() { fast(); int t; cin>>t; for(int i=1; i<=t; i++) { cin>>choice; while(!b.empty()) b.pop(); while(!f.empty()) f.pop(); url = "http://www.lightoj.com/"; cout<<"Case "<<i<< ":"<<endl; while(choice!="QUIT") { next(); if(turn==0) { b.push(url); cin>>url; cout<<url<<endl; while(!f.empty()) f.pop(); } else if(turn==1) { if(f.empty()) cout<<"Ignored"<<endl; else { b.push(url); url=f.top(); f.pop(); cout<<url<<endl; } } else { if(b.empty()) cout<<"Ignored"<<endl; else { f.push(url); url=b.top(); b.pop(); cout<<url<<endl; } } cin>>choice; } } }
Public Pastes
Try to broke dicti...
C# | 32 min ago
Lab3. 2
C++ | 35 min ago
Test touch screen
Lua | 47 min ago
Основы С++ / Тема...
C++ | 1 hour ago
Untitled
C | 1 hour ago
Untitled
C# | 1 hour ago
SLA Email Alert
C | 1 hour ago
Paste Ping
C | 1 hour ago
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!