摘要: find prime number within n;#include <iostream> #include <vector> #include <set> #include <cmath> using namespace std; bool isPrime(int n) { if( n==2) return true; int temp = (int)sqrt( (double)n); for( int i=2; i<temp; i++) { if( n%i==0) return false; } return true; } vect 阅读全文
posted @ 2013-01-25 06:37 西施豆腐渣 阅读(127) 评论(0) 推荐(0)
摘要: Valid ParenthesesJan 30 '12Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct order,"()"and"()[]{}"are all valid but"(]" 阅读全文
posted @ 2013-01-25 05:00 西施豆腐渣 阅读(148) 评论(0) 推荐(0)