OS X 清洁地升级安装

尝鲜可能太急切,还是得慢慢啃黑苹果

Screen Shot 2015-10-23 at 5.29.49 AMScreen Shot 2015-10-23 at 16.50.01Screen Shot 2015-10-24 at 1.01.36 PM

OS X 10 11 SIP对NVRAM的重大影响

  • SIP是OS X El Capitan中新增的一大特性。
  • NVRAM断电后不丢失其中保存到信息。

这两大因素给予了我长达半个月的软硬件故障的困扰,几乎走投无路。

具体症状是每次启动黑苹果都会出现的错误报告,偶尔还附带着屏幕上的条带状花屏:

Read more

BestCoder

Solved Problems
SDOI
Reorder the Books

SDOI

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* 2015年10月10日 下午6:54:59
* PrjName:Bc59-01
* @ Semprathlon
*/
import java.io.*;
import java.util.*;
public class Main {
static Person[] ps;
static ArrayList<Person> li=new ArrayList<Person>();
public static void main(String[] args) throws IOException{
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out);
int T=in.nextInt();
while(T-->0){
int n=in.nextInt();
int m=in.nextInt();
float x1=0,x2=0;
int female=0,h=0;
ps=new Person[n];
for(int i=0;i<n;i++){
ps[i]=new Person(in.next(), in.next(), in.nextInt(), in.nextInt());
female+=ps[i].sex;
if (ps[i].sex==1&&h==0) h=i;
x1=Math.max(x1, ps[i].s1);
x2=Math.max(x2, ps[i].s2);
}
li.clear();
for(int i=0;i<n;i++){
ps[i].s1*=300;ps[i].s1/=x1;
ps[i].s2*=300;ps[i].s2/=x2;
ps[i].s=ps[i].s1*(float)0.3+ps[i].s2*(float)0.7;
if (female>0){
if (ps[i].s>ps[h].s&&ps[i].sex==1) h=i;
}
else
if (ps[i].s>ps[h].s) h=i;
//li.add(ps[i]);
}
out.println("The member list of Shandong team is as follows:");
Person p0=new Person();
if (female>0){
// out.println(li.get(h).name);
p0=new Person(ps[h]);
ps[h].s=-1;
m--;
}
Arrays.sort(ps, new Person.comp());
li.clear();

for(int i=0;i<m;i++)
li.add(ps[i]);
if (female>0){
li.add(p0);m++;
}
ps=li.toArray(new Person[0]);
Arrays.sort(ps, new Person.comp());
for(int i=0;i<m;i++)
out.println(ps[i].name);

}
out.flush();
out.close();
}
}
class Person{
String name;
int sex;
float s1,s2,s;
Person(){}
Person(Person p){
name=new String(p.name);
sex=p.sex;
s1=p.s1;
s2=p.s2;
s=p.s;
}
Person(String nm,String sx,int _s1,int _s2){
name=new String(nm);
if (sx.charAt(0)=='m') sex=0;
else sex=1;
s1=_s1;s2=_s2;
}
void debug(PrintWriter out){
out.println(name+"\t"+sex+"\t"+s);
}
static class comp implements Comparator<Person> {
public int compare(Person p1,Person p2){
return -Float.compare(p1.s, p2.s);
}
}
}

Reorder the Books

思索再三,竟然连充分条件、必要条件都没找准,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/** Oct 13, 2015 8:55:41 PM
* PrjName:hdu5500
* @author Semprathlon
*/
import java.io.*;
import java.util.*;
public class Main {
static int[] a;
public static void main(String[] args) throws IOException{
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out);
int T=in.nextInt();
while(T-->0){
int n=in.nextInt();
a=new int[n+1];
for(int i=1;i<=n;i++)
a[in.nextInt()]=i;
int ans=0;
// if (a[n]!=n&&a[n]!=1) ans++;
int k=a[n];
for(int i=n;i>1;i--)
if (a[i-1]<k){
k=a[i-1];n--;
}
else
break;
// out.println(n);
for(int i=n-1;i>1;i--){
if (a[i]==1)
continue;
boolean need=false;
for(int j=1;j<i;j++)
if (a[j]>a[i]) need|=true;
for(int j=i+1;j<=n;j++)
if (a[j]<a[i]) need|=true;
if (need){
ans++;
for(int j=1;j<=n;j++)
if (a[j]<a[i])
a[j]++;
a[i]=1;
}
}
if (a[1]!=1) ans++;
out.println(ans);
}
out.flush();
out.close();
}
}

观察、归纳后可以优化到最简,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class Main {
static int[] a;
public static void main(String[] args) throws IOException{
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out);
int T=in.nextInt();
while(T-->0){
int n=in.nextInt();
a=new int[n+1];
for(int i=1;i<=n;i++)
a[in.nextInt()]=i;
int ans=0;
int k=a[n],h=0;
for(int i=n;i>1;i--){
if (a[i-1]>k){
ans++;
a[i-1]=h--;
}
k=a[i-1];
}
if (a[1]!=h+1) ans++;
out.println(ans);
}
out.flush();
out.close();
}

}

Clover 升级后检测不到Windows引导的解决办法

为了配合OS X
的更新,打算从Clover r2485升级到r2850;在EFI分区进行替换后发现新Clover引导界面找不到Windows操作系统。
经过三番五次的备份还原后终于发现,是EFI/Clover/drivers64UEFI目录下缺少必要的驱动文件所致。
将新旧版本的drivers64UEFI文件夹合并(若文件同名则以新易旧)即可排除错误。

OS X下的一些故障排除

  • When using App Store, it occurs that “ … failed to download. Use the Purchases page to try again.”

    Suggestions may help, but it is more applicable to restart the mac…

BestCoder

1001 Clarke and minecraft

玩过MC无压力

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/** Sep 19, 2015 7:12:36 PM
* PrjName:Bc56-01
* @author Semprathlon
*/
import java.io.*;
import java.util.*;
public class Main {

/**
* @param args
*/
final static int maxn=110;
static int cnt;
static int[] w;
static HashMap<Integer, Integer> mp=new HashMap<Integer,Integer>();
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out);
int T=in.nextInt();
//h=new int[maxn];
w=new int[maxn];
while(T-->0){
int n=in.nextInt();
cnt=0;
mp.clear();
Arrays.fill(w, 0);
for(int i=1;i<=n;i++){
int k=in.nextInt();
if (mp.containsKey(k))
w[mp.get(k)]+=in.nextInt();
else{
w[cnt]+=in.nextInt();
mp.put(k, cnt++);
}
}
int sum=0;
for(int i=0;i<cnt;i++)
sum+=(w[i]+63)/64;
out.println((sum+35)/36);
}
out.flush();
out.close();
}
}

1002 Clarke and problem

第一时间想到的是容斥,而后才逐渐醒悟过来是DP。。。
另外mod的遗漏又错了一发。。。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/** Sep 19, 2015 7:24:54 PM
* PrjName:Bc56-02
* @author Semprathlon
*/
import java.io.*;
import java.util.*;
public class Main {

/**
* @param args
*/
final static int maxn=1010;
final static int high=1000000000;
final static int mod=1000000007;
//static int[] s=new int[maxn];
static int[][] f=new int[2][maxn];
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out);
int T=in.nextInt();
while(T-->0){
int n=in.nextInt();
int p=in.nextInt();
//Arrays.fill(s, 0, p, 0);
Arrays.fill(f[0], 0, p, 0);
f[0][0]=1;
int cnt=0;
//for(int j=0;j<p;j++)out.print(f[j]+" ");out.println();
for(int i=1;i<=n;i++){
int k=in.nextInt();
while(k<0) k+=p;
k%=p;
Arrays.fill(f[cnt^1], 0,p,0);
for(int j=0;j<p;j++){
f[cnt^1][(k+j)%p]+=f[cnt][j];
f[cnt^1][(k+j)%p]%=mod;
}
for(int j=0;j<p;j++){
f[cnt^1][j]+=f[cnt][j];
f[cnt^1][j]%=mod;
}
cnt^=1;
}
out.println(f[cnt][0]);

}
out.flush();
out.close();
}
}

1003 Clarke and puzzle

没有总结好Nim游戏的规律啊。。。超简单的代码

2015 ACM/ICPC Asia Regional Shenyang Online

Show All Problems

Soluble Problems
Jesus Is Here

Jesus Is Here

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/** Sep 19, 2015 12:41:25 PM
* PrjName:0919-10
* @author Semprathlon
*/
import java.io.*;
import java.util.*;
public class Main {

/**
* @param args
*/
static long[] s,l,f,ans;
static String[] sh,sr;
final static int maxn=201315;
final static long mod=530600414L;
static long mul_mod(long n, long m, long mod) {
long ans = 0L;
n %= mod;
while (m > 0L) {
if ((m & 1L) > 0L)
ans = (ans + n) % mod;
m >>= 1;
n = (n + n) % mod;
}
return ans;
}
static void init(){
s=new long[maxn];
l=new long[maxn];
f=new long[maxn];
ans=new long[maxn];
sh=new String[maxn];
sr=new String[maxn];
s[1]=s[2]=0;s[3]=1;s[4]=3;
f[1]=f[2]=0;f[3]=f[4]=1;
l[1]=1;l[2]=2;l[3]=3;l[4]=5;
ans[1]=ans[2]=ans[3]=ans[4]=0;
sh[3]=new String("cf");sr[3]=new String("ff");
sr[4]=new String("ff");sr[4]=new String("ff");
}
static long solve(int n/*,PrintWriter out*/){
long res=0L;
if (n<5) return res;
if (ans[n]>0L) return ans[n];
res+=solve(n-2);
res+=solve(n-1);
//res+=solve(n-2,out);
//res+=solve(n-1,out);
sh[n]=sh[n-2];sr[n]=sr[n-1];
boolean has=false;
if (sr[n-2].compareTo("cf")==0&&sh[n-1].charAt(0)=='f'){
has=true;s[n]+=l[n-2]-1;
res-=s[n-2];
res+=mul_mod((l[n-2]-1),f[n-2],mod);
}
if (sr[n-2].charAt(1)=='c'&&sh[n-1].compareTo("ff")==0){
has=true;s[n]+=l[n-2];
res-=s[n-2];
res+=mul_mod(l[n-2],f[n-2],mod);
}
s[n]+=(s[n-2]+s[n-1]+mul_mod(l[n-2],f[n-1],mod))%mod;s[n]%=mod;
f[n]=has?f[n-2]+f[n-1]+1:f[n-2]+f[n-1];f[n]%=mod;
l[n]=l[n-2]+l[n-1];l[n]%=mod;
//out.print(n+":");out.print(res+" ");
res-=mul_mod(s[n-2],f[n-1],mod);//out.print(res+" ");
//res+=s[n-1]*(has?f[n-2]+1:f[n-2]);out.print(res+" ");
//res+=l[n-2]*f[n-1];out.println(res+" ");
res+=mul_mod(s[n-1]+mul_mod(l[n-2],f[n-1],mod),f[n-2],mod);//out.println(res+" ");
while(res<0L) res+=mod;
//if (has) res+=
res%=mod;
ans[n]=res;
return res;
}
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out);
int T=in.nextInt(),cas=0;
init();
for(int i=5;i<maxn;i++)
solve(i);
while(T-->0){
//long k=solve(in.nextInt(), out);
long k=solve(in.nextInt());
out.println("Case #"+(++cas)+": "+k);
}
out.flush();
out.close();
}
}

就差一点了,只剩减法取模的方法不太科学。
递归形式有利于寻找思路,改写成非递归形式更简练。

2015 ACM/ICPC Asia Regional Changchun Online

Show All Problems

Soluble Problems
Alisha’s Party
Unknown Treasure

Alisha’s Party

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/** Sep 13, 2015 12:39:06 PM
* PrjName:0913-01
* @author Semprathlon
*/
import java.io.*;
import java.util.*;

public class Main {
static Person[] per;
static Pair[] cm;
static PriorityQueue<Person> que = new PriorityQueue<Person>(new Person.Comp());
static Vector<String> ans = new Vector<String>();

public static void main(String[] args) throws IOException {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int T = in.nextInt();
while (T-- > 0) {
int n = in.nextInt();
int m = in.nextInt();
int q = in.nextInt();
per = new Person[n];
for (int i = 0; i < n; i++)
per[i] = new Person(in.next(), in.nextInt(), i + 1);
cm = new Pair[m];
for (int i = 0; i < m; i++)
cm[i] = new Pair(in.nextInt(), in.nextInt());
Arrays.sort(cm, new Pair.Comp());
que.clear();
int t = 0;
ans.clear();
for (int i = 0; i < n; i++) {
que.add(per[i]);
if (t < m && cm[t].l == i + 1) {
for (int j = 0; j < cm[t].r && !que.isEmpty(); j++)
ans.add(que.poll().name);
t++;
}
}
while (!que.isEmpty())
ans.add(que.poll().name);
while (q-- > 0) {
out.print(ans.get(in.nextInt() - 1) + (q > 0 ? " " : ""));
}
out.println();
}
out.flush();
out.close();
}
}

class Person {
String name;
int v, t;
Person() {
}
Person(String _nm, int _v, int _t) {
name = _nm;
v = _v;
t = _t;
}
static class Comp implements Comparator<Person> {
public int compare(Person p1, Person p2) {
if (p1.v == p2.v)
return Integer.compare(p1.t, p2.t);
return -Integer.compare(p1.v, p2.v);
}
}
}

class Pair {
int l, r;
Pair() {
}
Pair(int a, int b) {
l = a;
r = b;
}
static class Comp implements Comparator<Pair> {
public int compare(Pair o1, Pair o2) {
if (o1.l == o2.l)
return Integer.compare(o1.r, o2.r);
return Integer.compare(o1.l, o2.l);
}
}
}

能不能别再搞那个复杂的合并了啊……还有不要对空优先队列做push操作啊……

Unknown Treasure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/** Sep 13, 2015 9:26:58 AM
* PrjName:0913-10
* @author Semprathlon
*/
import java.io.*;
import java.util.*;

public class Main {

final static int maxn = 110000;
static long[] fac = new long[maxn];
static long[] p, a;
static long x, y;

static void Get_Fac(long n) {
fac[0] = 1;
for (int i = 1; i <= n; i++) {
fac[i] = fac[i - 1] * i;
fac[i] %= n;
}
}

static void extgcd(long a, long b) {
if (b == 0L) {
x = 1L;
y = 0L;
return;
}
extgcd(b, a % b);
long t = x;
x = y;
y = t - a / b * y;
}

static long pow_mod(long n, long m, long mod) {
long res = 1L;
n %= mod;
while (m > 0L) {
if ((m & 1L) > 0L)
res = res * n % mod;
n = n * n % mod;
m >>= 1;
}
return res;
}

static long mul_mod(long n, long m, long mod) {
long ans = 0L;
n %= mod;
while (m > 0L) {
if ((m & 1L) > 0L)
ans = (ans + n) % mod;
m >>= 1;
n = (n + n) % mod;
}
return ans;
}

static long div_mod(long n, long m, long mod) {
return n * pow_mod(m, mod - 2, mod) % mod;
}

static long C(long n, long m, long mod) {
int a = (int) (n % mod), b = (int) (m % mod);
return div_mod(fac[a], mul_mod(fac[a - b], fac[b], mod), mod);
}

static long Lucas(long n, long m, long mod) {
long ret = 1L;
while (n > 0L && m > 0L) {
if (n % mod < m % mod)
return 0L;
ret = mul_mod(ret, C(n, m, mod), mod);
ret %= mod;
n /= mod;
m /= mod;
}
return ret;
}

// 中国剩余定理 x == a[i] (mod m[i]) 共有n个方程。
static long CRT(long n, long[] a, long[] m) {
long pro = 1L, res = 0L;
for (int i = 0; i < n; i++)
pro *= m[i];
for (int i = 0; i < n; i++) {
long w = pro / m[i];
extgcd(m[i], w);
res = (res + mul_mod(y, mul_mod(w, a[i], pro), pro)) % pro;
}
return (res + pro) % pro;
}

public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int T = in.nextInt();
while (T-- > 0) {
long n = in.nextLong();
long m = in.nextLong();
long num = in.nextLong();
p = new long[15];
a = new long[15];
for (int i = 0; i < num; i++)
p[i] = in.nextLong();
for (int i = 0; i < num; i++) {
Get_Fac(p[i]);
a[i] = Lucas(n, m, p[i]);
}
out.println(CRT(num, a, p));
}
out.flush();
out.close();
}

}

一堆数论模板的集体亮相……但是为何解n个方程的中国剩余定理模板就难以被收集?