Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <queue>
#include <vector>
#include <sstream>
using namespace std;
typedef pair<int, int> P;
typedef vector<vector<int> > matrix;
package test;
import java.util.Scanner;
public class Test {
private final static int HIGHEST = 8;
public static void main(String[] args) {
int[] bits = new int[HIGHEST];
@psychicalcoder
psychicalcoder / Main.java
Created December 16, 2017 15:40
overflow example
package test;
public class Main {
public static void main(String[] args) {
byte x = 0;
for (int i = 0; i < 8; i++) {
x |= 1 << i;
}
System.out.println(x);
#include <cstdio>
int main() {
int n,ans=0,t=0,i;
bool flag = true;
while(scanf("%d",&n)==1){
if(n==0&&!flag)break;
if(n==0){
printf("%d\n",ans-t);
ans=0;
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
int a[16],d[1<<16][16];
const int INF = (int)1e8;
int main() {
int k,t,n,ans;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",a+i);
#include <cstdio>
struct Tp {
int h,m,s;
bool operator < (const Tp& x)const{
if(h==x.h){
if(m==x.m)return s<x.s;
else return m<x.m;
}else return h<x.h;
}
Tp operator - (const Tp& x){
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
while(scanf("%d%d", &n, &m)==2) {
bool flag = true;
int a, b;
set<int> M[10001];
vector<int> W[10001];
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1000005;
int a[maxn],f[maxn];
int main() {
int T, n;
scanf("%d", &T);
while(T--) {
scanf("%d", &n);
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 102;
struct P {
int r, c;
P() {}
P(int R, int C):r(R), c(C){}
};
#include <cstdio>
#include <cmath>
const double eps = 1e-5;
double f(double x) {
return pow(2, abs(x));
}
double trinary_search(double l, double r) {
double t1,t2,a1,a2;