This file contains hidden or 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 <stdio.h> | |
int main() | |
{ | |
int a = 5, b = 7; | |
a = a ^ b; | |
b = a ^ b; | |
a = a ^ b; | |
printf("a=%d b=%d", a, b); | |
return 0; |
This file contains hidden or 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
data; | |
set Crops := wheat corn beets; | |
param TotalArea:=500; | |
param BeetsQuota:=6000; | |
param Yield := | |
wheat 2.5 | |
corn 3.0 | |
beets 20.0; | |
param MinRequirement := | |
wheat 200 |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Aug 28 10:28:18 2013 | |
@author: King | |
""" | |
import httplib | |
import urllib2 |
This file contains hidden or 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
# If you have access to a function that returns a random integer from one to five, | |
# write another function which returns a random integer from one to seven. | |
import random | |
class Solution(): | |
def rand5(self): | |
return random.randint(1, 5) |
This file contains hidden or 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
def solution(h, m): | |
""" Return the degree bewteen hour hand and minute hand | |
""" | |
min_deg = float(m) / 60 * 360 | |
hour_deg = float(h) / 12 * 360 + float(m) / 60 * 360 / 12 | |
return min(abs(min_deg - hour_deg), 360 - abs(min_deg - hour_deg)) |
This file contains hidden or 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
N = int(raw_input()) | |
with open('outfile.txt', 'w') as outfile: | |
for test in range(N): | |
words = raw_input().strip().split(" ") | |
outfile.write("Case #{}: ".format(test + 1) + " ".join(words[::-1]) + "\n") |
This file contains hidden or 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
N = int(raw_input()) | |
with open('outfile.txt', 'w') as outfile: | |
for test in range(N): | |
size = int(raw_input()) | |
v1 = sorted(map(int, raw_input().split(" ")), reverse=True) | |
v2 = sorted(map(int, raw_input().split(" "))) | |
pro = 0 | |
for i in range(size): | |
pro += v1[i] * v2[i] | |
outfile.write("Case #{}: ".format(test + 1) + str(pro) + "\n") |
This file contains hidden or 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
all: webserver | |
webserver: webserver.o tcp.o request.o | |
gcc webserver.o tcp.o request.o -o webserver -g -lpthread | |
webserver.o: webserver.c | |
g cc -Wall -g -c webserver.c -o webserver.o | |
tcp.o: tcp.c tcp.h | |
gcc -Wall -g -c tcp.c -o tcp.o |
This file contains hidden or 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
# _________________________________________________________________________ | |
# | |
# Pyomo: Python Optimization Modeling Objects | |
# Copyright (c) 2014 Sandia Corporation. | |
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, | |
# the U.S. Government retains certain rights in this software. | |
# This software is distributed under the BSD License. | |
# _________________________________________________________________________ | |
# | |
# Farmer: rent out version has a scalar root node var |
This file contains hidden or 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
# -*- coding: utf-8 | |
""" | |
A deterministic model of farmer's problem: | |
""" | |
try: | |
from pyomo.core import * | |
from pyomo import * | |
from pyomo.opt import * | |
from pyomo.core.base import * |
OlderNewer