算法
文章平均质量分 71
doom463
这个作者很懒,什么都没留下…
展开
-
Topcoer-single round-Bonuses
public class Bonuses {public static void main(String args[]){new Bonuses();}public Bonuses(){int[] points={1,2,3,4,5};int[] result=getDivision(points);for(int i=0;iSystem.out.print(res原创 2012-07-19 10:18:51 · 150 阅读 · 0 评论 -
Topcoer-single round-PouringWater
public class PouringWater {public static void main(String args[]) {new PouringWater();}public PouringWater() {// System.out.println(getMinBottles(3, 1));System.out.println(getMinBottle原创 2012-07-20 08:46:14 · 231 阅读 · 0 评论 -
Topcoer-single round-Time
public class Time {public Time(){System.out.println(whatTime(3661));}public String whatTime(int seconds){int hour;int min;int sec;hour=seconds/3600;seconds=seconds%3600;min=secon原创 2012-07-20 08:48:55 · 198 阅读 · 0 评论 -
扫雷核心算法c++实现
#include #include #include using namespace std; class Algo{public:Algo(int w=10,int h=10);void show();void flip(int x,int y);bool satisfy(int x,int y);private:int w,h;int**原创 2012-07-25 15:50:24 · 627 阅读 · 0 评论 -
俄罗斯方块核心算法实现c++
class Algo{public:Algo(int w,int h);void nextSec();void nextShape();void changeShape();void showShape();void showShape2();void start();bool inRec(int x,int y);void left();void ri原创 2012-07-29 19:59:31 · 566 阅读 · 0 评论 -
poj 1068-Parencodings-Tehran 2001
#include using namespace std;int main(){int n,m=0,temp;int x=0;char seq[21];int index=0;cin>>n;for(int i=0;icin>>m;index=0;for(int j=0;jtemp=x;cin>>x;if(j==0){//coutfor原创 2012-07-30 11:48:06 · 310 阅读 · 0 评论 -
poj 1051-P,MTHBGWB-Greater New York 2001
#include #include using namespace std;int getLength(char temp);string getMorse(char temp);char getLetter(char* num,int ci,int l);int main(){int m;cin>>m;cin.get();int num[101];in原创 2012-07-30 13:26:23 · 563 阅读 · 0 评论 -
poj 1080-Human Gene Functions
#include #include using namespace std;int max(int x,int y,int z);int geta(char x,char y);int t[202][202];int main(){int casenum;//freopen("in.txt","r",stdin);cin>>casenum;while(cas原创 2012-07-31 22:11:42 · 267 阅读 · 0 评论 -
poj 1125 Stockbroker Grapevine
#include using namespace std;int main(){int array[101][101];int n;while(cin>>n){if(n==0)break;for(int i=1;ifor(int j=1;jarray[i][j]=0xffff;}}for(int i=1;iint m;cin>>m;for原创 2012-10-22 12:03:38 · 276 阅读 · 0 评论 -
poj 1159 Palindrome
#include #include #define MAX 5002using namespace std;unsigned short array [MAX][MAX];int main(){int N;cin>>N;string input;cin>>input;//coutmemset(array,0,sizeof(array));for(in原创 2012-10-22 12:04:38 · 252 阅读 · 0 评论 -
Topcoer-single round-PasswordXGuessing
public class PasswordXGuessing {public static void main(String args[]) {new PasswordXGuessing();}public PasswordXGuessing() {String[] g = {"4747", "4747", "4747", "4747"};System.out.pr原创 2012-07-20 08:44:55 · 221 阅读 · 0 评论 -
Topcoer-single round-PeopleCircle
public class PeopleCircle {public static void main(String args[]) {new PeopleCircle();}public PeopleCircle() {// String ret="mmmm";// int index=0;// System.out.println(ret.substring(原创 2012-07-20 08:45:24 · 207 阅读 · 0 评论 -
Topcoer-single round-CCipher
public class CCipher {public static void main(String args[]) {new CCipher();}public CCipher() {System.out.println(decode("LIPPSASVPH", 4));}public String decode(String cipherText原创 2012-07-19 10:19:38 · 157 阅读 · 0 评论 -
Topcoer-single round-ElectionFraudDiv2
public class ElectionFraudDiv2 {public static void main(String args[]) {new ElectionFraudDiv2();}public ElectionFraudDiv2() {System.out.println(IsFraudulent(new int[] {3, 1, 4, 1, 5, 9,原创 2012-07-19 10:21:09 · 177 阅读 · 0 评论 -
Topcoer-single round-HillHike
public class HillHike {public static void main(String args[]) {new HillHike();}public HillHike() {int d = 38;int m = 11;int[] l = { 3, 5, 8, 5, 6 };long result = numPaths(d, m, l);原创 2012-07-19 10:22:44 · 188 阅读 · 0 评论 -
Topcoer-single round-ImageDithering
public class ImageDithering {public static void main(String args[]){new ImageDithering();}public ImageDithering(){String d="BW";String[] s={"AAAAAAAA","ABWBWBWA","AWBWBWBA","ABWBWBWA原创 2012-07-19 10:23:28 · 157 阅读 · 0 评论 -
Topcoer-single round-MinimumLiars
public class MinimumLiars {public MinimumLiars() {int[] array=new int[6];array[0]=0;array[1]=0;array[2]=0;array[3]=4;array[4]=3;array[5]=0;System.out.println(getMinimum(array));原创 2012-07-19 10:26:29 · 206 阅读 · 0 评论 -
Topcoer-single round-MNS
import java.util.Vector;public class MNS {public static void main(String[] args) {new MNS();}private Vector rset = new Vector();public int ret = 0;public MNS() {// Syst原创 2012-07-19 10:27:02 · 203 阅读 · 0 评论 -
Topcoer-single round-PlatypusPaternity
public class PlatypusPaternity {public static void main(String args[]) {new PlatypusPaternity();}public PlatypusPaternity() {String[] f = { "YYNNYYNNYYNN", "YNYNYNYNYNYN", "YYYNNNYYYNNN"原创 2012-07-20 08:45:52 · 197 阅读 · 0 评论 -
Topcoer-single round-PowerOutage
public class PowerOutage {public static void main(String args[]) {new PowerOutage();}public int Count = 0;public int TotalCount = 0;boolean[] walked = new boolean[50];public Powe原创 2012-07-20 08:47:40 · 204 阅读 · 0 评论 -
Topcoer-single round-RandomColoringDiv2
public class RandomColoringDiv2 {public static void main(String args[]) {new RandomColoringDiv2();}public RandomColoringDiv2() {System.out.println(getCount(6, 9, 10, 1, 2, 3, 4, 10));}原创 2012-07-20 08:48:02 · 256 阅读 · 0 评论 -
poj 1004 Financial Management
#include #include using namespace std;int main(){double balance;double totalbalance=0;for(int i=0;icin>>balance;totalbalance+=balance;}coutreturn 0;}原创 2012-10-22 12:08:48 · 263 阅读 · 0 评论 -
poj 1047 Round and Round We Go
#include #include using namespace std;int main(){int round[61][61];int n;int temp[61];string input;while(cin>>input){n=input.length();for(int i=0;ifor(int j=0;jround[i][j]=原创 2012-10-22 12:12:02 · 163 阅读 · 0 评论 -
Topcoder-SRM597DIV2-250
#include #include #include #include using namespace std;class LittleElephantAndDouble{public:string getAnswer(vector A){sort(A.begin(),A.end());int max=A[A.size()-1];for(int i=0;i原创 2013-12-01 10:12:17 · 331 阅读 · 0 评论 -
Topcoder-SRM598DIV2-250
#include #include using namespace std;class ErasingCharacters{public:string simulate(string s){bool disposed=true;while(disposed){disposed=false;for(int i=0;iif(s[i]==s[i+1]){dis原创 2013-12-01 08:41:13 · 537 阅读 · 0 评论 -
Topcoder-SRM598DIV2-1000
#include using namespace std;class FoxAndFencingEasy{public:string WhoCanWin(int mov1,int mov2,int d){if(mov1>=d)return "Ciel";else if(mov1>2*mov2)return "Ciel";else if(mov2>2*mov1)原创 2013-12-01 08:43:01 · 517 阅读 · 0 评论 -
Topcoder-SRM598DIV2-500
#include #include #include using namespace std;class BinPackingEasy{public:int minBins(vector item){sort(item.begin(),item.end());int l=0,r=item.size()-1;int ret=0;while(lif(l==r原创 2013-12-01 08:42:19 · 400 阅读 · 0 评论 -
Topcoder-SRM596DIV2-500
#include #include using namespace std;class ColorfulRoad{#define INF 5000public:int getMin(string road){int count=road.length();int D[count];for(int i=1;iD[0]=0;for(int i=1;ifo原创 2013-12-02 03:35:01 · 424 阅读 · 0 评论 -
Topcoder-SRM596DIV2-250
#include #include #include using namespace std;class FoxAndSightseeing{public:int getMin(vector position){int distanceLess[position.size()];for(int i=1;idistanceLess[i]=abs(position原创 2013-12-02 03:34:17 · 402 阅读 · 0 评论 -
Topcoer-YahtzeeScore-146-Div2-250 Points
public class YahtzeeScore {public static void main(String args[]) {new YahtzeeScore();}public YahtzeeScore() {int[] t = { 5, 3, 5, 3, 3 };System.out.println(maxPoints(t));}publ原创 2012-07-20 08:50:10 · 203 阅读 · 0 评论 -
Topcoer-UnluckyIntervals-SRM438-Div1
public class UnluckyIntervals {public static void main(String args[]){new UnluckyIntervals();}public UnluckyIntervals(){int[] luckySet={5, 11, 18};int[] result=getLuckiest(luckySet,9);原创 2012-07-20 08:49:19 · 218 阅读 · 0 评论 -
Topcoer-VendingMachine-SRM-145-DIV 2
import java.util.StringTokenizer;public class VendingMachine {public static void main(String args[]) {new VendingMachine();}public VendingMachine() {String[] prices ={"100 200 300"原创 2012-07-20 08:49:43 · 243 阅读 · 0 评论 -
Topcoder-SRM597DIV2-500
#include #include using namespace std;#include class LittleElephantAndString{public:int getNumber(string A,string B){string tA,tB;tA=A;tB=B;sort(tA.begin(),tA.end());sort(tB.be原创 2013-12-01 10:13:06 · 372 阅读 · 0 评论 -
Assignment4 key to Introduction to MATLAB(MIT OPEN COURSEWARE)
rd.mZ=2+5*randn(500,1);mean(Z)std(Z)handlesPractice.mx=[0:2*pi/100:2*pi];y=sin(x);figure;plot(x,y,'r');xlim([0 2*pi]);set(gca,'XTick',[0 pi 2*pi]);set(gca,'XTickLabel原创 2013-04-01 07:14:36 · 610 阅读 · 0 评论 -
poj 1163 The Triangle
#include using namespace std;#define MAX 250int main(){int array[MAX][MAX];int N;cin>>N;for(int i=1;ifor(int j=1;jcin>>array[i][j];}}for(int i=0;iarray[i][0]=0;array[i][i+1原创 2012-10-22 12:05:19 · 252 阅读 · 0 评论 -
poj 1003 Hangover
#include using namespace std;#define MAXSIZE 300int main(){double res[MAXSIZE];res[0]=0;res[1]=1.0/2;for(int i=2;ires[i]=res[i-1]+1.0/(i+1);//cout}double input;cin>>input;原创 2012-10-22 12:09:56 · 157 阅读 · 0 评论 -
poj 1082 Calendar Game
#include using namespace std;int res[110][12][31];void getnextday(int *y,int *m,int *d){ if(*m==1 || *m==3 || *m==5 || *m==7 || *m==8 || *m==10){ if(*d *原创 2012-10-22 12:12:36 · 211 阅读 · 0 评论 -
poj 1028 Web Navigation
#include #include #include using namespace std;int main(){string input;string url;stack past;stack future;past.push("http://www.acm.org/");/*past.push("hello1");past.push("hell原创 2012-10-22 12:07:04 · 273 阅读 · 0 评论 -
poj 1046 Color Me Less
#include using namespace std;int main(){int largeSet[16][3];for(int i=0;icin>>largeSet[i][0];cin>>largeSet[i][1];cin>>largeSet[i][2];//cout}int x,y,z;cin>>x;cin>>y;cin>>z原创 2012-10-22 12:09:19 · 268 阅读 · 0 评论 -
poj 1056 IMMEDIATE DECODABILITY
#include #include using namespace std;#define MAXSIZE 65535int decodablef(char* a,char* b);int main(){string input;char array[MAXSIZE][11];int csize;bool decodable=true;int index原创 2012-10-22 12:11:26 · 151 阅读 · 0 评论