Skip to content
This repository was archived by the owner on Dec 29, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 50 additions & 21 deletions cpp/42.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,50 @@
#include <iostream>
#include <vector>

using namespace std;

int main()
{
vector<int> list;
int x = 0;
while(x != 42)
{
scanf("%d",&x);
if(x!=42)
list.push_back(x);
}
for(int i=0 ; i < (signed)(list.size()) ; i++)
{
printf("%d\n",list.at(i));
}
return 0;
}
#include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
template <class ll>
void fastscan(ll &number)
{
//variable to indicate sign of input number
bool negative = false;
register ll c;

number = 0;

// extract current character from buffer
c = getchar_unlocked();
if (c=='-')
{
// number is negative
negative = true;

// extract the next character from the buffer
c = getchar_unlocked();
}

// Keep on extracting characters if they are integers
// i.e ASCII Value lies from '0'(48) to '9' (57)
for (; (c>47 && c<58); c=getchar_unlocked())
number = number *10 + c - 48;

// if scanned input has a negative sign, negate the
// value of the input number
if (negative)
number *= -1;
}

// Function Call
int main()
{
fastIO;
while (true)
{
ll n;
fastscan(n);
if (n==42)
break;
else
cout<<n<<"\n";
}
}