This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Shell script that configures gnome-terminal to use solarized theme | |
# colors. Written for Ubuntu 11.10, untested on anything else. | |
# | |
# Solarized theme: http://ethanschoonover.com/solarized | |
# | |
# Adapted from these sources: | |
# https://gist.github.com/1280177 | |
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//from int to char | |
while(n>0){ | |
ch[i]=(n%10)+'0'; | |
n=n/10; | |
i++; | |
} | |
while(i>0){ | |
putchar(ch[i-1]); | |
i-- | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MessagingController < ApplicationController | |
include ActionController::Live | |
def send_message | |
response.headers['Content-Type'] = 'text/event-stream' | |
10.times { | |
response.stream.write "This is a test Messagen" | |
sleep 1 | |
} | |
response.stream.close |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################### | |
##########Puzzle##################### | |
##################################### | |
read(n,m,f[1..m]) | |
sort(f[1..m]) | |
best = INFINITY | |
for k=1 to m-n | |
best = min(best, f[k+n-1]-f[k]) | |
print best |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jonathan Paulson, 11th in ACM-ICPC 2013, GCJ 2013 Finals | |
Votes by Max Plank, Anton Leonov, Ben Alpert, and 220 more. | |
Go to Timus Online Judge, and work down in order. If you get bored, skip down a ways. If you can't solve the problem, look at the per-problem forum. If that doesn't help, ask someone (like StackOverflow, or a friend, or Quora, or...) | |
Once you've done 50-100 of those, you can write some code and maybe know a few basic algorithms. Go to Codeforces and do their weekly-ish contests. Do TopCoder contests too. When you don't get problems, figure them out afterwards. | |
Once you get into Div 1 on Codeforces/TopCoder, you have some skills: | |
1) You are an algorithms/data structures "expert". You probably know as much as most undergraduates at top CS schools and enough to get a job at Google or similar | |
2) You can actually write code, which is apparently a surprisingly rare skill. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <cmath> | |
#include <iomanip> | |
using namespace std; | |
int main(){ | |
vector<double> v; | |
double n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main(){ | |
vector<int> inputs; | |
int input; | |
while(cin>>input) | |
inputs.push_back(input); | |
int length = inputs.size(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
int multi(int x, int y){ | |
if(y==0) | |
return 0; | |
int z = multi(x, y/2); | |
if(y%2 == 0) | |
return 2*z; | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "iostream" | |
#include "vector" | |
using namespace std; | |
int main(){ | |
int input; | |
int inputs; | |
bool existence = false; | |
vector<int> values; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "iostream" | |
#include "vector" | |
using namespace std; | |
int main(){ | |
int input; | |
int inputs; | |
bool existence = false; | |
vector<int> values; |
OlderNewer