隐马尔可夫模型介绍见这里:点击打开链接
Peter's Hobby
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 362 Accepted Submission(s): 160
Problem Description Recently, Peter likes to measure the humidity of leaves. He recorded a leaf humidity every day. There are four types of leaves wetness: Dry , Dryish , Damp and Soggy. As we know, the humidity of leaves is affected by the weather. And there are only three kinds of weather: Sunny, Cloudy and Rainy.For example, under Sunny conditions, the possibility of leaves are dry is 0.6.
Give you the possibility list of weather to the humidity of leaves.
The weather today is affected by the weather yesterday. For example, if yesterday is Sunny, the possibility of today cloudy is 0.375.
The relationship between weather today and weather yesterday is following by table:
Now,Peter has some recodes of the humidity of leaves in N days.And we know the weather conditons on the first day : the probability of sunny is 0.63,the probability of cloudy is 0.17,the probability of rainny is 0.2.Could you know the weathers of these days mZ??http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vc3QgcHJvYmFibHkgbGlrZSBpbiBvcmRlcj8KCiAKPGJyPgoKSW5wdXQKClRoZSBmaXJzdCBsaW5lIGlzIFQsIG1lYW5zIHRoZSBudW1iZXIgb2YgY2FzZXMsIHRoZW4gdGhlIGZvbGxvd2luZ3MgYXJlIFQgY2FzZXMuIGZvciBlYWNoIGNhc2U6PGJyPgpUaGUgZmlyc3QgbGluZSBpcyBhIGludGVnZXIgbihuPD01MCksbWVhbnMgdGhlIG51bWJlciBvZiBkYXlzLCBhbmQgdGhlIG5leHQgbiBsaW5lcywgZWFjaCBsaW5lIGlzIGEgc3RyaW5nIHNob3dzIHRoZSBodW1pZGl0eSBvZiBsZWF2ZXMgKERyeSwgRHJ5aXNoLCBEYW1wLCBTb2dneSkKCiAKPGJyPgoKT3V0cHV0CgpGb3IgZWFjaCB0ZXN0IGNhc2UsIHByaW50IHRoZSBjYXNlIG51bWJlciBvbiBpdHMgb3duIGxpbmUuIFRoZW4gaXMgdGhlIG1vc3QgcG9zc2libGUgd2VhdGhlciBzZXF1ZW5jZS4oIFdlIGd1YXJhbnRlZSB0aGF0IHRoZSBkYXRhIGhhcyBhIHVuaXF1ZSBzb2x1dGlvbikKCiAKPGJyPgoKU2FtcGxlIElucHV0Cgo8cHJlIGNsYXNzPQ=="brush:java;">1 3 Dry Damp Soggy
Sample Output
Case #1:
Sunny
Cloudy
Rainy
HintLog is useful.
Author FZU
Source 2014 Multi-University Training Contest 1
#include
#include
#include
#include
#include
using namespace std; int n; double lea[3][4]= { {0.6,0.2,0.15,0.05}, {0.25,0.3,0.2,0.25}, {0.05,0.1,0.35,0.5} }; double wea[3][3]= { {0.5,0.375,0.125}, {0.25,0.125,0.625}, {0.25,0.375,0.375} }; int ord[100],pre[100][100]; double dp[100][100]; void output(int day,int weather) { if(day<0) return; output(day-1,pre[day][weather]); //cout<<"day: "<
mx) { mx=temp; mr=k; } } dp[i][j]=mx; pre[i][j]=mr; } } double mx=-1000000000;int mr=-1; for(int i=0;i<3;i++) { if(mx