Created
April 12, 2013 03:21
-
-
Save tsu-nera/5369076 to your computer and use it in GitHub Desktop.
SRM 576, Division 2 Level1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <vector> | |
| using namespace std; | |
| class TheExperimentDiv2 { | |
| public: vector<int> determineHumidity(vector<int> intensity, int L, vector<int> leftEnd) { | |
| int N = (int)intensity.size(); | |
| int M = (int)leftEnd.size(); | |
| bool drop_flag[N]; | |
| vector<int>absorbed; | |
| int i, j, k; | |
| for(i=0; i<N; i++) { | |
| drop_flag[i] = false; | |
| } | |
| for(i=0; i<M; i++) { | |
| int temp = 0; | |
| for(j=0; j<L; j++) { | |
| k = leftEnd[i]+j; | |
| if( drop_flag[k] == 0 ) { | |
| temp += intensity[k]; | |
| drop_flag[k] = true; | |
| } | |
| } | |
| absorbed.push_back(temp); | |
| } | |
| return absorbed; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment