Categories
爪机爪机

HTC CDMA手机3G跳1X的解决办法

  • 问题描述:

在有3G信号的地方,手机也会时不时跳到1X网络。
 

  • 可能原因:

主要出现在拥有4G网络支持的机子上,初步感觉是会寻找4G基站然后跳到了1X,可以通过修改网络制式的方法解决问题。
 

  • 解决方案:

就是修改当前的网络模式,把CDMA/LTE中的LTE去掉。
可行方案:

  1. *#*#4636#*#*,里面有手机测试,把网络改成CDMA auto(PRL)
  2. 如果固件屏蔽了这个东西,下载个调出相关程序的软件设置
  3. 如果手机重启后会恢复原来的设置,可以尝试修改文件
/system/build.prop

里面找到

ro.telephony.default_network=xxx

之类的,比如我原来的是=10的,就是CDMA/EvDo/LTE AUTO
改成

ro.telephony.default_network=4

这个就是 CDMA auto(prl)了
切记区分CDMA only/CDMA auto(prl)/EvDo only,最前面那个只有1X网络,中间的是自动选,后面的那个是只有EvDo(数据)的

Categories
生活琐碎

期末周

期末考就要来了,复习进度上课,痛苦的是网络的外教课还得上一周,希望能有所收获吧。
暑期估计都要在杭州过了,因为浙大那边实验室确认收人了,刚好也好久没回家了。
至于其他学校只能先搁置了,暑假好好表现吧,权衡各方面来说也许呆在杭州前景也挺好。
目前最要紧的事情是把期末考搞定,这个应该是大学生涯最后3门考试周的考试了…要画上圆满的句号。

Categories
生活琐碎

有缘无分?

交大电院那边面试时间刚好跟SRTP答辩冲突,考虑到诸多因素,初步决定还是不去了,虽然南京离上海很近,可是要去的话估计还是得今晚出发什么的。之前软院那边的夏令营因为可能和浙大那边实习冲突,所以也拒绝了,复旦那边嘛估计也差不多状况。就感觉一下子放弃了好多机会,孤注一掷的感觉,不知道最后落得个什么下场。。。
幸好9月份还有正式的推免复试,之前另外了解到一些情况,也向学长打听了点东西,总归这条路不是想象中那么轻松就能走通的。
现在只能指望浙大那边有人要我了?感觉特别被动…

Categories
不学无术

1032. Sharing (25)

时间限制

100 ms
内存限制
32000 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example, “loading” and “being” are stored as showed in Figure 1.

Figure 1
You are supposed to find the starting position of the common suffix (e.g. the position of “i” in Figure 1).
Input Specification:
Each input file contains one test case. For each case, the first line contains two addresses of nodes and a positive N (<= 105), where the two addresses are the addresses of the first nodes of the two words, and N is the total number of nodes. The address of a node is a 5-digit positive integer, and NULL is represented by -1.
Then N lines follow, each describes a node in the format:
Address Data Next
where Address is the position of the node, Data is the letter contained by this node which is an English letter chosen from {a-z, A-Z}, andNext is the position of the next node.
Output Specification:
For each case, simply output the 5-digit starting position of the common suffix. If the two words have no common suffix, output “-1” instead.
Sample Input 1:

11111 22222 9
67890 i 00002
00010 a 12345
00003 g -1
12345 D 67890
00002 n 00003
22222 B 23456
11111 L 00001
23456 e 67890
00001 o 00010

Sample Output 1:

67890

Sample Input 2:

00001 00002 4
00001 a 10001
10001 s -1
00002 a 10002
10002 t -1

Sample Output 2:

-1

 

====================================
没啥技术含量的题,记得早些年数据结构期中考考过,当时觉得好难
其实如果标记下走过哪里的话就好简单
没啥好说的,注意输出格式,比如1要变成00001
===================================

#include 
#include 
#include  // std::setfill, std::setw
using namespace std;
#define END_OF_NODE -1
#define MAX_NODE_QTY 100000
struct Node
{
	char letter;
	int nextPtr;
	bool visited;
	Node()
	{
		nextPtr = END_OF_NODE;
		visited = false;
	}
};
Node nodes[MAX_NODE_QTY];
int main()
{
	int root_A_ptr, root_B_ptr;
	int N;
	scanf("%d %d %d", &root_A_ptr, &root_B_ptr, &N);
	//Read node infomation
	for(int i=0; i

测试点 结果 用时(ms) 内存(kB) 得分/满分
0 答案正确 0 1650 10/10
1 答案正确 0 1770 1/1
2 答案正确 0 1900 8/8
3 答案正确 0 1630 1/1
4 答案正确 0 1780 2/2
5 答案正确 30 1900 3/3

Categories
免费VρN发布

免费联通WiFi账号/密码

手头有一堆联通WiFi的账号,如果有需要的请回复你的邮箱地址索要
有些省市的不支持多人同时登录,有些可以,有些可能临时无法使用,免费的嘛反正~你懂的
总有一个能用的

Categories
不学无术

1007. Maximum Subsequence Sum (25)

时间限制

400 ms
内存限制
32000 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
Given a sequence of K integers { N1, N2, …, NK }. A continuous subsequence is defined to be { Ni, Ni+1, …, Nj } where 1 <= i <= j <= K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For example, given sequence { -2, 11, -4, 13, -5, -2 }, its maximum subsequence is { 11, -4, 13 } with the largest sum being 20.
Now you are supposed to find the largest sum, together with the first and the last numbers of the maximum subsequence.
Input Specification:
Each input file contains one test case. Each case occupies two lines. The first line contains a positive integer K (<= 10000). The second line contains K numbers, separated by a space.
Output Specification:
For each test case, output in one line the largest sum, together with the first and the last numbers of the maximum subsequence. The numbers must be separated by one space, but there must be no extra space at the end of a line. In case that the maximum subsequence is not unique, output the one with the smallest indices i and j (as shown by the sample case). If all the K numbers are negative, then its maximum sum is defined to be 0, and you are supposed to output the first and the last numbers of the whole sequence.
Sample Input:

10
-10 1 2 3 4 -5 -23 3 7 -21

Sample Output:

10 1 4

==============================================
这是一个经典问题,可以利用《编程珠玑》第8章<算法设计技术>里面的扫描算法
算法不写了,书上一模一样的原题,伪代码如下:

maxsofar = 0
maxendinghere = 0
for i = [0,n)
    /* invariant: maxendinghere and maxsofar
       are accurate for x[0..i-1] */
    maxendinghere = max(maxendinghere + x[i], 0)
    maxsofar = max(maxendinghere, maxsofar)

只不过这里输出的时候要输出首末位置的数字,所以加了一些变量。
什么时候会改变首末位置呢:
1. maxEndingHere == 0的时候,表示如果后面还会有更好的结果的话,肯定开始的位置是从这个点之后的一个数字开始的。此时要记录可能会产生gap,留给后续处理
2.当到达vStartIndex,别忘了记下<可能的>新的起点
3.当后面那一坨真的比原来的值还大时,如果存在gap,那要用新的起点替换掉旧的,然后吧gap开关关上,一个新的开始
4.当算出来总数maxEndingHere比maxSofar大时,别忘了记下当前位置的数值作为末尾数值
另外要注意,如果全是负值怎么处理,特别注意这样的输入,不能以maxSofar是否>0判断

3
-1 0 -1

代码中startIndex与endIndex是不必要存储的。
=============================================

#include 
#include  //max
using namespace std;
int main()
{
	int N;
	scanf("%d", &N);
	long maxSofar = 0;
	long maxEndingHere = 0;
	int startVal = 0;
	int startIndex = -1;  //
	int vStartIndex = 0;//
	int vStartVal = 0;
	int endIndex = -1;//
	int endVal = 0;
	bool hasGap = true;
	bool allNegative = true;
	//int *savedVals = new int[N];
	int totalStartVal;
	int totalEndVal;
	for(int i=0; i= 0 && allNegative)
			allNegative = false;
		if(i==0)
			totalStartVal = inputVal;
		else if(i == N-1)
			totalEndVal = inputVal;
		//savedVals[i] = inputVal;
		maxEndingHere = max( maxEndingHere + inputVal, (long)0);
		if(maxEndingHere == 0)
		{
			hasGap = true;
			vStartIndex = i+1;
		}
		if(i == vStartIndex)
			vStartVal = inputVal;
		if( maxEndingHere > maxSofar)
		{
			maxSofar = maxEndingHere;
			endIndex = i;
			endVal = inputVal;
			if(hasGap)
			{
				startIndex = vStartIndex;
				startVal = vStartVal;
				hasGap = false;
			}
		}
	}
	if(!allNegative)
		printf("%ld %d %d", maxSofar, startVal, endVal);
	else
		printf("%ld %d %d", maxSofar, totalStartVal, totalEndVal);
	return 0;
}

测试点 结果 用时(ms) 内存(kB) 得分/满分
0 答案正确 0 750 2/2
1 答案正确 0 790 1/1
2 答案正确 0 790 3/3
3 答案正确 0 790 4/4
4 答案正确 0 790 4/4
5 答案正确 0 790 3/3
6 答案正确 0 790 3/3
7 答案正确 0 750 5/5

Categories
不学无术

1027. Colors in Mars (20)

1027. Colors in Mars (20)

时间限制
400 ms
内存限制
32000 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 digits for Green, and the last 2 digits for Blue. The only difference is that they use radix 13 (0-9 and A-C) instead of 16. Now given a color in three decimal numbers (each between 0 and 168), you are supposed to output their Mars RGB values.
Input
Each input file contains one test case which occupies a line containing the three decimal color values.
 
Output
For each test case you should output the Mars RGB value in the following format: first output “#”, then followed by a 6-digit number where all the English characters must be upper-cased. If a single color is only 1-digit long, you must print a “0” to the left.
Sample Input

15 43 71

Sample Output

#123456

 

===============================
没啥技术含量。
===============================

#include 
#include 
using namespace std;
string GetRGBVal(int val)
{
	char ret[3];
	ret[2] = '';
	int count = 1;
	while( count >= 0)
	{
		if(val == 0)
			ret[count] = '0';
		int temp = val % 13;
		if(temp >9)
		{
			temp -= 10;
			temp += 0x41;
		}
		else
			temp += 0x30;
		val /= 13;
		ret[count--] = (char)temp;
	}
	return string(ret);
}
int main()
{
	int rgb[3];
	cin >> rgb[0] >> rgb[1] >> rgb[2];
	cout << "#";
	for(int i=0; i<3; i++)
	{
		cout << GetRGBVal(rgb[i]);
	}
	return 0;
}
Categories
生活琐碎

SJTU软院面试

没啥特别的感觉
老师还不错,边上还有个妹纸…不过貌似是打杂的
别的没什么咯

Categories
不学无术

1039. Course List for Student (25)

1039. Course List for Student (25)

时间限制
200 ms
内存限制
32000 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course list for each student who comes for a query.
Input Specification:
Each input file contains one test case. For each case, the first line contains 2 positive integers: N (<=40000), the number of students who look for their course lists, and K (<=2500), the total number of courses. Then the student name lists are given for the courses (numbered from 1 to K) in the following format: for each course i, first the course index i and the number of registered students Ni (<= 200) are given in a line. Then in the next line, Ni student names are given. A student name consists of 3 capital English letters plus a one-digit number. Finally the last line contains the N names of students who come for a query. All the names and numbers in a line are separated by a space.
Output Specification:
For each test case, print your results in N lines. Each line corresponds to one student, in the following format: first print the student’s name, then the total number of registered courses of that student, and finally the indices of the courses in increasing order. The query results must be printed in the same order as input. All the data in a line must be separated by a space, with no extra space at the end of the line.
Sample Input:

11 5
4 7
BOB5 DON2 FRA8 JAY9 KAT3 LOR6 ZOE1
1 4
ANN0 BOB5 JAY9 LOR6
2 7
ANN0 BOB5 FRA8 JAY9 JOE4 KAT3 LOR6
3 1
BOB5
5 9
AMY7 ANN0 BOB5 DON2 FRA8 JAY9 KAT3 LOR6 ZOE1
ZOE1 ANN0 BOB5 JOE4 JAY9 FRA8 DON2 AMY7 KAT3 LOR6 NON9

Sample Output:

ZOE1 2 4 5
ANN0 3 1 2 5
BOB5 5 1 2 3 4 5
JOE4 1 2
JAY9 4 1 2 4 5
FRA8 3 2 4 5
DON2 2 4 5
AMY7 1 5
KAT3 3 2 4 5
LOR6 4 1 2 4 5
NON9 0

=================================
PAT上通过率0.09的题目看着挺可怕
主要是时间的问题我想,做那么多次查询~
第一想法是直接用STL的map给名字做索引
这样的话搜索效率是O(log2n),因为map是用神马树实现的
不过…后来想想这个题目那么多跪了的,估计肯定不能用这个
只能拿空间换时间了~
权衡了一下,因为姓名是3个字母加1个数字,所以可以自己写个浪费空间的Hash函数,将名字的字母部分映射成数组的索引
哈希了一下嘛,时间复杂度就是O(1)了,邪恶一笑…
数组使用map>实现,显然前面那个int就是给字母最后的数字使用的,后面那个存的course的ID
这样可能稍微能节约点空间,不然26*26*26*10需要175760那么多地方…浪费地有点多
其他没有什么可以说的,里头有现成的sort,专门对付STL容器里头的排序,自己写个compare函数就行了,相当方便。
提交一次通过,虽然最长时间是180ms有点危险,不过不想再去折腾这个了。
==================================

#include 
#include 
#include 
#include 
using namespace std;
map< int, vector> stu_cou_map[17576];
inline int GetHashIndex(char name[])
{
	//给出一个名字比如BOB5,得到对应 stu_cou_map的索引号
	int index = 676 * (name[0] - 0x41) + 26 * (name[1] - 0x41) + (name[2] - 0x41);
	return index;
}
inline bool mySortFunc (int i, int j)
{
	return (i s;
				s.push_back(course_id);
				stu_cou_map[index].insert( pair>(suffix, s));
			}
			else
			{
				stu_cou_map[index][suffix].push_back(course_id);
			}
		}
	}
	for(int i=0; i s = stu_cou_map[index][suffix];
		printf(" %d", s.size());
		vector::iterator begin = s.begin();
		vector::iterator end = s.end();
		sort(begin, end, mySortFunc);
		for(vector::iterator it = begin; it!=end; it++)
		{
			printf(" %d", *it);
		}
		printf("n");
	}
	return 0;
}

==========================================
测试点 结果 用时(ms) 内存(kB) 得分/满分
0 答案正确 0 1250 15/15
1 答案正确 0 1380 2/2
2 答案正确 0 1380 2/2
3 答案正确 0 1380 2/2
4 答案正确 0 1380 2/2
5 答案正确 180 21700 2/2

Categories
不学无术

1051. Pop Sequence (25)

Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …, N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, if M is 5 and N is 7, we can obtain 1, 2, 3, 4, 5, 6, 7 from the stack, but not 3, 2, 1, 7, 5, 6, 4.
Input Specification:
Each input file contains one test case. For each case, the first line contains 3 numbers (all no more than 1000): M (the maximum capacity of the stack), N (the length of push sequence), and K (the number of pop sequences to be checked). Then K lines follow, each contains a pop sequence of N numbers. All the numbers in a line are separated by a space.
Output Specification:
For each pop sequence, print in one line “YES” if it is indeed a possible pop sequence of the stack, or “NO” if not.
Sample Input:

5 7 5
1 2 3 4 5 6 7
3 2 1 7 5 6 4
7 6 5 4 3 2 1
5 6 4 3 7 2 1
1 7 6 5 4 3 2

Sample Output:

YES
NO
NO
YES
NO

=================================
数据结构是个好东西。
输入的序列1,2,3,…,N其实是(废话本来就是)一个队列(下面记作seq),然后在弄一个容易被填满的栈…
以下栈底、队首用#号标识
然后看测试的序列,比如5 6 4 3 7 2 1,
1.先看栈顶元素,如果栈顶元素就是输入的元素的话,那就弹栈,然后继续循环
2.如果不是,那么就要将队列的头一直取出,填到栈里面,
直到:(A)栈满了,那么失败了
(B)现在栈顶的元素就是我们的输入元素,那么继续读下一个测试的数字
测试序列5 6 4 3 7 2 1中,一开始的元素是5,于是不断的从1234567这个队列中取头部出来,压栈,然后
栈S : #1 2 3 4 5
seq: # 6 7
满足调节后,下一个循环查看的时候,发现栈顶的5刚好是我们的输入元素,于是序列指针移到6上面,并且弹出5,
经过差不多的过程,变成这样
栈S : #1 2 3 4 6
seq : #7
之后这样
栈S : #1 2 3 4
seq : #7
,
栈S : #1 2 3
seq : #7
,
栈S : #1 2
seq : #7
,
栈S : #1 2 7
seq : #
,
栈S : #1 2
seq : #
,
。。。直到尽头,然后成功了
=======================================================
具体实现可能跟刚才的说法略有不一致,但是原理是一样的。

#include 
#include 
#include 
using namespace std;
int main()
{
    int M, N, K;
    queue sequences;
    queue copy_of_seq; //为了防止重复生成浪费时间
    scanf("%d %d %d", &M, &N, &K);
    //生成seq队列
    for(int i=1; i s;
        bool failed = false;
        int input_val;
        for(int i=0; i= M) //要留一个给后面再读入的相等的元素
                {
                    failed = true;
                    break;
                }
            }
            if( failed )
            {
                printf("NOn");
            }
            else if( copy_of_seq.empty() )
            {
                failed = true;
                printf("NOn");
            }
            else
            {
                //成功了..
                //s.push( copy_of_seq.front() ); (反正还要pop,不搞了)
                copy_of_seq.pop();
            }
            //如果头部还是与数字不同,那就fail
        }
        if (!failed)
            printf("YESn");
    }
    return 0;
}

测试点 结果 用时(ms) 内存(kB) 得分/满分
0 答案正确 0 740 15/15
1 答案正确 0 750 3/3
2 答案正确 0 790 2/2
3 答案正确 0 790 2/2
4 答案正确 0 750 1/1
5 答案正确 0 780 2/2