Categories
不学无术

1050. String Subtraction (20)

1050. String Subtraction (20)
时间限制
10 ms
内存限制
32000 kB
代码长度限制
16000 B
判题程序
Standard
Given two strings S1 and S2, S = S1 – S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 – S2 for any given strings. However, it might not be that simple to do it fast.
Input Specification:
Each input file contains one test case. Each case consists of two lines which gives S1 and S2, respectively. The string lengths of both strings are no more than 104. It is guaranteed that all the characters are visible ASCII codes and white space, and a new line character signals the end of a string.
Output Specification:
For each test case, print S1 – S2 in one line.
Sample Input:

They are students.
aeiou

Sample Output:

Thy r stdnts.

===================================================
不用动啥脑子的一道题,只要避免使用cin/cout就行了。反正内存给了好大好大,要争取时间的话,就给一共128个ascii字符做个map,里面存放是不是被ban掉了。
===================================================

#include 
using namespace std;
static char S1[10000];  //S1
static char S2[10000];  //S2
static char S3[10000];  //result
static bool mapAscii[127];
int main()
{
	char* pS1 = &S1[0];
	char* pS2 = &S2[0];
	gets(pS1);
	gets(pS2);
	int asc;
	while( (*pS2) != '')
	{
		asc = (int)(*pS2);
		mapAscii[asc] = true;
		pS2++;
	}
	char* pS3 = &S3[0];
	while( (*pS1) != '')
	{
		asc = (int)(*pS1);
		if(!mapAscii[asc])
		{
			(*pS3) = (char) asc;
			pS3++;
		}
		pS1++;
	}
	(*pS3) = ''; // EOL
	puts(&S3[0]);
	//system("pause");
	return 0;
}
Categories
不学无术 木有技术 爪机爪机

[转]android 人脸识别

source:http://blog.sina.com.cn/s/blog_677fb16e010148be.html

import android.app.Activity;
import android.widget.TextView;
import android.os.Bundle;
import android.media.FaceDetector;    // 人脸识别接口
import android.widget.ImageView;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
import android.graphics.PointF;
import android.graphics.Matrix;
import android.util.Log;
import android.graphics.Canvas;
import android.graphics.Paint;
public class MyDetectActivity extends Activity {
       private ImageView mImageView;    // 图片显示控件
       private Bitmap mBitmap;
       private float mScale = 1F;
       @Override
       public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                mImageView = (ImageView) this.findViewById(R.id.image);
                detect();      // 识别函数
       }
       private void handleFace(FaceDetector.Face f) {        // 在图片上对每张脸进行处理
                PointF midPoint = new PointF();
                int r = ((int) (f.eyesDistance() * mScale * 1.5));         // 取眼睛间距离
                f.getMidPoint(midPoint);       // 取脸的中点
                midPoint.x *= mScale;
                midPoint.y *= mScale;
                Canvas c = new Canvas(mBitmap);
                Paint p = new Paint();
                p.setAntiAlias(true);
                p.setAlpha(0x80);
                c.drawCircle(midPoint.x, midPoint.y, r, p)        // 用半透明标出人脸区域;
                mImageView.setImageBitmap(mBitmap);          // 显示图片
       }
       private void detect() {
                Matrix matrix = new Matrix();
                FaceDetector.Face[] mFaces = new FaceDetector.Face[3];         // 定义最多识别三张脸
                int mNumFaces = 0;
                mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.baby);     // 取原始图
                if (mBitmap == null) {
                         return;
                }
                if (mBitmap.getWidth() > 256) {
                         mScale = 256.0F / mBitmap.getWidth();
                }
                matrix.setScale(mScale, mScale);
                Bitmap faceBitmap = Bitmap.createBitmap(mBitmap, 0, 0, mBitmap
                                   .getWidth(), mBitmap.getHeight(), matrix, true);        // 生成缩放后的新图
                mScale = 1.0F / mScale;
                if (faceBitmap != null) {
                         FaceDetector detector = new FaceDetector(faceBitmap.getWidth(),
                                            faceBitmap.getHeight(), mFaces.length); // 创建识别器
                         mNumFaces = detector.findFaces(faceBitmap, mFaces);    // 识别
                         if (mNumFaces > 0) {
                                   for (int i = 0; i < mNumFaces; i++) {
                                            handleFace(mFaces[i]);        // 调用函数对人脸画面进行处理
                                   }
                         }
                }
       }
}
Categories
爪机爪机

[UTIL][Feb 02 2013] Apktool v1.5.2 百度网盘下载

原帖见:http://forum.xda-developers.com/showthread.php?t=1755243

Categories
爪机爪机

V版Galaxy S3 i535 最新Modem VRBMB1

I535VRBMB1
http://lt.imobile.com.cn/forum.php?mod=viewthread&tid=10286227&extra=page%3D1

Categories
爪机爪机

[原创]XT912 移动/联通 无法上网问题解决

 
xt912被买家退回,原因是移动联通无法上网,电信3G正常。

寻找原因之后,找到如下解决办法(适用于4.0.4以上固件,必须ROOT):

  • 参考此文:

http://bbs.gfan.com/android-5676667-1-1.html
电信卡在设置-》移动网络-》首选模式里 选 CDMA/EvDo自动(选全球模式可能不行)
移动联通在首选模式里选GSM/WCDMA自动
 

  • 尝试一下是不是APN没有设置的问题,用海卓APN什么的或者自己改一下APN..

本人江苏电信,在APN设置时效的时候局端会自动改成ctnet的APN。其他地区/公司不得而知
 

  • 本人手贱的原因,或者之前就没在意过这个问题:

[官方版或者官方基础上的修改版]:
拨号界面拨##7764726然后按通话,出来的界面输入SPC:000000,然后继续
进入第14项(LTE TEST UICC)
选择SIM TYPE
然后改成commercial
 
(如果换回电信卡之后无法上网,上面SIM TYPE改成3g test UICC,不过我的设置成commercial都能用了)
 
 

Categories
爪机爪机

[下载]gapps-jb-20130301-signed.zip

百度网盘下载:

http://pan.baidu.com/share/link?shareid=391045&uk=772481359

Categories
生活琐碎

日记日记

这两天都在忙驾校的事情。明日考科目3、4
希望一切顺利吧!
周末的时间都费在这个地方。
记下这天

Categories
爪机爪机

[i535] [ROM] MIUIAndroid – MIUIv4 – Build VI [3.2.13]

source:  http://forum.xda-developers.com/showthread.php?t=2028368

MIUIAndroid – MIUI 4.1 
Maintained by StrumerJohn
1. Place ROM zip file in your SD card
2. Boot into recovery
3. Create a backup
4. Factory reset device (Wipe Data), Wipe Cache and Wipe System and Dalvik Cache
5. Install zip from SD card


– No Major Issues Exist
—–

Code:
================================================
  MIUIAndroid - MIUI Build VI – 3/2/13  12:00
================================================
-	Removed Nightly “Tests”
-	Reverted all Nightly Changes
-	Rebased and Rebuilt from the Ground Up from:
- MIUI Base (3.2.22)
- CyanogenMod Base (10.0 STABLE – Final Release)
-	Updated RIL
-	“Fixed” 4G LTE
-	New 2G->3G->4G Handlings / Handoffs
-	New Verizon->Sprint->Other Roaming Handlings / Handoffs
-	Added “Global” Network Properties from TouchWiz
-	New APNs added
-	Services.jar Patched to fix Webkit Issues
-	Kernel updated and changed to Ktoonsez latest AOSP JB Kernel
-	Removed NavBar Modifications; sorry guys it’s just too buggy
-	META-INF Install Script overhauled
- Removed wipe on cache, davlik cache, and data
- Removed needless comments
- Removed empty lines
- New backup script included to protect against bad flashes
- New headers and warning with delay for battery pulls if needed
- Wipes System, and now finally Cache and (NOT your apps and stuff) Data efficiently
- Wipes old MIUI Cache files, folders, etc
- Wipes old TouchWiz Cache files, folders, etc
- Wipes old “Generic” or Stock Android folders not needed
- Fixed issue with failure status #7 that led to ROM not being installed first few flashes
- Updated GAPPS permissions
- Reorganized for installation optimization
- Optimizes phone partitions for installation of MIUI
-	Build.prop rebuilt and overhauled
- Battery Optimizations
- Performance Optimizations
- Proper MIUI Build set
- Proper Build date and time set
- Set Carrier to Verizon Wireless from “Unknown”
- Removed CM OTA Update Junk
-	Reverted Camera Libs to fix Flash, Camera, and Torch
-	Updated GPS.config For better, faster, stronger, lockdown
- Changed servers to North America
- Changed servers to USA
-	Updated AGPS data
-	Updated Fonts
-	Media Folder updated to latest MIUI’s
-	New Media Added (Added latest MI Tones, Sounds, etc and CyanogenMod Tones, Sounds, etc, and TouchWiz Tones, Sounds, etc)
-	Added Splashscreen back
-	New Wallpapers Added
-	New default theme properties
-	Fixed Flash Player Issues
-	Fixed Browser Force Closes
-	Fixed Music Player Force Closes
-	Fixed Theming issues where themes wouldn’t fully apply
-	Fixed Voicemail download problems (They still need a few minutes to load after you log in though)
-	Adjusted MMS compression a little bit higher so pictures don’t look like pixels
-	Fix in Voice Input Services where Microphone for input would recognize speech and light up gray, but never fully make it to recognizable red
-	Fix overheating issues phone would have occasionally
-	Fix Superuser issues where access was granted but parts of root access were still denied
-	Fixed permissions for GAPPS
-	Added in support / framework for Google 4.2 Jellybean Camera (Will be an Add-on)
-	Fixed issue with Face Unlock not appearing on Lock Screen
-	CyanogenMod’s Samsung Galaxy S III Settings added
-	Minimum Brightness is now lower!
-	Maximum Brightness is now higher!
-	Fix Emoji issues in Messaging app—they show now!
-	Updated MIUI Translations
-	Updated CyanogenMod Translations
-	Removed ICS/JB (4.1) Keyboard / Input
-	Added Audio Enhancements; Bravia, Beats, and more!
-	Updated All MIUI Apps
-	Included MI Keyboard
-	Updated MI Notes
-	Included MI Equalizer
-	Updated MIUI US Weather App
-	Included MIUI Weather Widget
-	Updated Trebuchet CyanogenMod Launcher
-	Included latest Adobe Flash Player – It’s also in Data/App so it’s delete-able!
-	Included KTweaker App for Kernel
-	Updated MI Home Launcher
-	Updated MI Compass
-	Updated MI Gallery
-	Updated MI Music
-	Updated MI File Explorer
-	Updated MI Stats
-	Updated MI VideoPlayer
-	Updated MI MusicFX
-	Updated Calculator
-	Updated Downloads
-	Updated JB Control Panel
-	Updated Verizon Apps*
-	Updated Google Apps*
-	Updated Superuser
-	Zip Aligned
-	Zip Signed
-	Other Minor Bug Fixes
Older changelogs are temporarily unavailable.


Build VI
Download: http://d-h.st/erQ
MD5: 80733b14a9e00f7e374e1f51107a85d1
Older Builds:

  


Add me on Google+

StrumerJohn
Bleelas
Evo4gNoob

Beanstown106
CyanogenMod Team
MIUI Devs
Con247

Donation List:
Thanks guys!  You deserve a spot in the OP too!
1. FAEHSEMC
2. Dubin04
3. CockyRob X2!
4. Bichigo
5. Undarated
6. Rampantandroid

Categories
爪机爪机

[翻译][教程]如何解包 Galaxy S3 官方固件(.img文件) !!

source:http://forum.xda-developers.com/showthread.php?t=1667081
软件需求:
* 7-zip (用于解包md5文件)
* JDK (用于运行jar程序)
步骤:

Quote:
Quote:
–当你解压缩官方的 ROM .zip , 你会放到 3个 .md5后缀的文件.利用 7-zip,分别解压每个 .md5 文件. 注意,在解压 .md5文件的过程中, 7-zip 或许会提示出错, 不过这无关紧要,可以忽略.
Quote:
—当你解压完所有的md5文件后, 你会发现很多 .img 后缀的文件. 对于系统分区来说,主要是解压 system.img. 这个 system.img并不像一般 nandroid 备份使用yaff打包方法.因此, unyaffs tool 无法 解包这个奇怪的 system.img
Quote:
—为了解包 system.img, 下载这个工具: sgs2toext4 (由 drphrozen 发明). 下载完将其中的 sgs2toext4.jar 文件解压出来.
Quote:
–打开命令提示符,并且定位到你当前sgstoext4.jar那个文件的目录.
Quote:
—输入 sgs2toext4.jar 然后按回车.
Quote:
–这个 .jar 会在新窗口中运行,并且让你讲  system.img 文件拖拽至新窗口中e. 按照提示操作,等待完成.
Quote:
–任务完成后,你会在原有img文件目录下发现一个新的文件 system.ext4.img.
Quote:
—现在,下载 Diskinternals Linux Reader 并安装. 然后打开这个程序, —>> Drives –> Mount Image –> 选择 system.ext4.img > Mount
Quote:
–完成后程序会显示img文件内所有的内容. 全选 –> 右击鼠标 –> save ,然后选一个地方保存他们. 然后一切就搞定了

同样的,你可以尝试使用上述方法解包cache,data,boot.img .
如果希望 de-odex 固件, 尝试使用 AutoDeoTool(由 xavierjohn22 开发- thread)
鸣谢: (别忘了感谢他们!)
efrant – post’s link
drphrozen – post’s link
—Information gathered from this post & things in blue text under How to Flash).
Try n reply !!

Categories
不学无术

1041. Be Unique (20)

一道难题?主要是木有方法。

1041. Be Unique (20)

时间限制  
20 ms
内存限制
32000 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
Being unique is so important to people on Mars that even their lottery is designed in a unique way.  The rule of winning is simple: one bets on a number chosen from [1, 104].  The first one who bets on a unique number wins.  For example, if there are 7 people betting on 5 31 5 88 67 88 17, then the second one who bets on 31 wins.
Input Specification:
Each input file contains one test case.  Each case contains a line which begins with a positive integer N (<=105) and then followed by N bets.  The numbers are separated by a space.
Output Specification:
For each test case, print the winning number in a line.  If there is no winner, print “None” instead.
Sample Input 1:

7 5 31 5 88 67 88 17

Sample Output 1:

31

Sample Input 2:

5 888 666 666 888 888

Sample Output 2:

None

本人解答:

//#include 
//#include 
#include 
#include 
using namespace std;
const int MAX_NUM_A = 10001;
//const int MAX_NUM_B = 10000;
int storage[MAX_NUM_A] = {0};
//list possibles;
int possibles[MAX_NUM_A] = {0};
//0代表尚未存储,-1代表已经超额,其余代表输入时的顺序(第几个输入的这个数)
//int sequence[MAX_NUM_B];
//list ary_list;
/*
inline void remove(int r)
{
	//remove item from array
	ary_list.remove(r);
}
*/
int main()
{
	clock_t  clockBegin, clockMid, clockEnd;
	int possibleN = 0;
	int N;
	//cin >> N;
	scanf("%u",&N);
	int input;
	clockBegin = clock();
	for (int i=0; i> input;
		scanf("%u", &input);
		if(storage[input] == 0)
		{
			//尚未输入过这个数
			storage[input] = i+1; //记录输入的顺序
			//possibleN ++;
			//possibles.push_back(input);
			possibles[possibleN++] = input;
		}
		else
		{
			//重复了!
			//if(storage[input] > 0)
			//{
				//possibles.remove(input);
				//possibleN --;
			//}
			storage[input] = -1;
		}
	}
	/*
	if(possibles.size() <= 0)
	{
		cout << "None";
		return 0;
	}
	*/
	clockMid = clock();
	//cout << clockMid - clockBegin << endl;
	printf("%un",clockMid - clockBegin);
	//int count = ary_list.size();
	int min_seq = MAX_NUM_A;
	int min_val = -1;
	int i=0;
	while(i < possibleN)
	{
		int temp = storage[possibles[i]];
		if(temp > 0)
		{
			//if(temp < min_seq)
			//{
				min_seq = temp;
				min_val = possibles[i];
				break;
			//}
		}
		//possibles.pop_front();
		i ++ ;
	}
	clockEnd = clock();
	//cout << clockEnd - clockMid << endl;
	printf("%un",clockEnd - clockMid);
	if(min_val != -1)
	{
		//cout << min_val;
		printf("%u",min_val);
		return 0;
	}
	//cout << "None";
	printf("None");
	return 0;
}

知道结论是什么么?
结论是sscan比cin效率高很多!