#2242: 為啥會RE搞不懂= =


bird (GG)


//============================================================================
// Name        : none.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
using namespace std;
const int MAX=1000;
float arr[MAX];
int main() {
    char ch[MAX];
    char* ptr;
    while(gets(ch))
    {
        int c=0;
        float odd=0,even=0;
        ptr=strtok(ch,": ");
        while(ptr!=NULL)
        {
            arr[c++]=atof(ptr);
            ptr=strtok(NULL,": ");
        }
        for(int i=0;i<c;i+=2)
        {
            if(((int)arr[i])%2)
                odd+=arr[i+1];
            else
                even+=arr[i+1];
        }
        cout<<odd-even<<endl;
        memset(arr,0.0,MAX);
    }
    return 0;
}
#2244: Re:為啥會RE搞不懂= =


morris1028 (碼畜)


陣列開得不夠大

開個3000吧 !