- 博客(28)
- 资源 (1)
- 收藏
- 关注
原创 sgu499
//暴力求解复杂度为O(n(n-1)/2)//假设所有输入中最大值为maxp,枚举i=maxp to 1(从大到小枚举),//如果i是某两个数的约数,则i是所有数的最大最大公约数。//复杂度 ??#include #include #define maxn 1000005 int num[maxn]; int main() { int n,i,j,k;
2016-02-23 21:07:00
543
原创 sgu 318
/*** * 以资源为列,用户为行,统计资源列有多少个不同值,去掉空值,即为答案。 */import java.util.*;import java.io.*;public class Solution {public static void main(String[] argv) throws IOException {BufferedReader in = new BufferedReader
2015-10-11 11:36:38
418
原创 some useful softwares in linux
1. graphic user interfasexorg / xinit - xserver systemopenbox - a window manager2. toolsgcc g++ gdb make git - version control toolmit-scheme - scheme interpretoremacs - a editor
2014-01-03 17:39:20
572
原创 debian wheezy sources.list
open the setting file: /etc/apt/sources.listadd the follow code:deb http://http.debian.net/debian wheezy main contrib non-freedeb http://mirrors.163.com/debian wheezy main contrib non-free deb h
2014-01-03 17:14:39
1304
原创 openbox shortcut keybind and menu settings
1. keybindfind the file ~/.config/openbox/rc.xmlin the node , add below code: emacs x-www-browser x-terminal-em
2014-01-03 17:08:20
1026
原创 sgu 178
f(n)表示问题的解 第一步:将n0 = n分成三部分a1 ,b1= 1, n1;其中a1 = n0 - n1 - 1,a1 〉= n1;n1 是之后要分解的 ,可行解为 f(n1)我们得到 a1,b1, f(n1)前n1天,用n1(会拆开)支付,解为f(n1)第n1+1天用 b1支付第n1+2天用a1(完整的)支付,必须找零a1 - 1,店主有n1+1个,所以必须有
2013-07-23 17:17:30
780
转载 setup emacs for windows
1. download emacs-24.3-bin-i386.zip, form http://mirrors.ustc.edu.cn/gnu/emacs/windows/ 2. unzip it to a directory, such as d:\, you will get d:\emacs-24.3\ 3. add shortcut to start menu
2013-07-18 17:22:13
652
转载 stl support for gdb: gdb-stl-views
# # STL GDB evaluators/views/utilities - 1.03## The new GDB commands:
2013-07-17 10:46:11
980
原创 windows emacs R ess
- setup emacs - setup R - setup ess - add Rterm.exe to path - finish.
2013-06-28 09:44:36
580
转载 setup virtual box extention for lubuntu
# before setup virtual box extention for lubuntusudp apt-get install dkms gcc make
2013-06-27 21:18:35
567
转载 WARNING: gnome-keyring:: couldn't connect to
- problem:WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-rof1VB/pkcs11: No such file or directory - solution/usr/bin/gnome-keyring-daemon --start --components=pkcs11 - re
2013-06-27 21:15:13
1185
原创 sgu 125
AC之后看大网上别人的基本是dfs、暴力搜索因为我的算法不是这样,贴出来看看sgu结果: Accepted 31 ms 835 kb 英文很烂,注释看不懂可email /** * @file * @brief my c solution for problem 125 on SGU OJ * @author ck * @date 2013-06-19 *
2013-06-20 21:49:42
889
原创 sgu 120
#include #include const double PI = 3.1415926535897932384626;int n, n1, n2;double n1x, n1y, n2x, n2y;int main() { scanf("%d%d%d", &n, &n1, &n2); scanf("%lf%lf%lf%lf", &n1x, &n1y, &n2x, &n2
2013-04-16 20:30:23
509
原创 sgu 193
/* if n = a*b + r and gcd(n, r) = 1 then ans = max{a, b} (a, b <= n/2) if n = 2p + 1 then ans = p; else n = 2p let p = 2q+r if r=0 then n = 4q =2(2q - 1) + 2, gcd(n, 2q-1) = gcd(
2013-04-15 15:16:19
535
原创 sgu 226
/*notice: the graph may contain loops between two point,there may be many ways that have different color */#include #include using namespace std;const int INF = 0x7ffffffe;int n, m;int
2013-04-10 11:16:52
651
原创 sgu 403
/* 是某某的1/x 居然被翻译成: which is x times less than ... */#include int main() { int x; scanf("%d", &x); printf("%d\n", (x<<1) + 1); return 0;}
2013-04-07 17:01:26
506
原创 sgu 224
//dfs// k = 0, ans = 1;// k = 1, ans = n*n ;// k > n, ans = 0;//还可以进一步优化 // if (n - ps < k - count) rollback; 当剩余列数小于剩余棋子数时,回滚// 对称性优化, 第一个棋子放在某一列m行,和放在该列n-m+1// 直接用数组保存所有结果 ---
2013-04-07 14:46:37
695
原创 sgu 259
/* greedy method sort the leaflets by Li by descending order let sumTk = Ti + T2 + ..... Tk answer = max ( sumTk + Lk), k = 1...nproofproof by contradiction : 假设最优序列为 a = { 1, 2, 3 ..
2013-04-05 17:38:12
597
原创 sgu 223
/*状态压缩dp每一行的可行状态进行压缩 , n=3时 s = {000, 001, 010, 100, 101}d[row][si][p] 表示 第row行状态为si,前row-1行已放置且不冲突,总共放了p个棋子的方案数初始状态 d[0][0][0] = 1, others = 0;递推公式 d[row][s[i]][p + c[i]] = sigma(d[row-1][s[j]
2013-04-03 10:10:28
623
原创 sgu 296
#include #define NONE 'n'/*升序数列,删除前面的高位降序数列,删除后面的低位先处理升序*/char n[1009];int k;// find the next digit after digit a, return -1 when can not find.int next(int a) {
2013-03-11 15:57:18
519
原创 sgu 316
题目中: Each shot always reduces the hit points of the target tank by 8, and if the number of hit points of the targetbefore the shot was greater than zero, the shooting tank receives 3 score points.
2013-03-09 17:02:40
830
原创 sgu404
#include int main() { int n, m, i ; char s[109]; scanf("%d%d", &n, &m); n %= m; if (n==0) { n = m; } for (i=1; i<=m; ++i) { scanf("%s", s); if (i
2013-03-09 15:49:14
479
原创 sgu 302
#include #include void putUpper(char c) { if (c >= 'a') { //c is lowercase putchar(c - 32); } else { putchar(c); }}void putLower(char c) { if (c <= 'Z') {
2013-03-08 16:42:25
613
原创 sgu 276
#include int main() { int p, s; int t[] = {1, 300, 900, 1800, 10800 }; scanf("%d%d", &s, &p); p -= s; s = 0; while (t[s] <= p) ++s; printf("%d\n", s); return 0
2013-03-08 14:41:18
562
原创 sgu 222
#include int p(int a, int b) { if (b > a) { return 0; } else if (b == 0) { return 1; } else { int i = a - b + 1; int r = a; while (i < a) { r *= i; ++i; } return r; }}in
2013-03-06 17:58:39
593
原创 sicp excercise 2.54
(define (equal? x y) (cond ((and (null? x) (null? y)) true) ((and (not (pair? x)) (not (pair? y))) (eq? x y)) ((and (pair? x) (pair? y) (equal? (car x) (car y))
2012-12-31 17:01:58
316
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人