Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.3 kB
3
Indexable
Never
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
vector <string>data;
vector <vector<int>>input_data;
vector <int>vtemp;
int pamount,clause;

void load()
{
    string s1,s2;
    string s;
    int temp=0;
    cin>>s1;
    cin>>s2;
    bool neg=false;
    while(s1!="p"||s2!="cnf")
    {
        s1 = s2;
        cin >> s1;
    }
    cin >> pamount;
    cin >> clause;
//
    for(int i=0;i<(int)clause;i++)
    {
        getline(cin,s);
        for(int j=0;j<(int)s.size();)
        {
            while(s[j]!='0')
            {
                temp=0;
                if(s[j]!=' ')
                {
                    if(s[j]=='-')
                        neg=true;
                    else
                        temp=temp*10+((int)s[j])-48;
                    j++;
                }
                else
                {
                    if(neg)
                        vtemp.push_back(temp*(-1));//分行後暫存
                    else
                        vtemp.push_back(temp);
                }
                neg=false;
                j++;
            }
        }
        input_data.push_back(vtemp);
        vtemp={0};
    }
}
int main()
{
    load();
    return 0;
}
Leave a Comment