本文整理汇总了C++中set::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ set::push_back方法的具体用法?C++ set::push_back怎么用?C++ set::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类set
的用法示例。
在下文中一共展示了set::push_back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insert
void insert(const SPIID & x) {
#ifdef SPIIDSET_USE_SET
d_data.insert(x);
#else
d_data.push_back(x);
#endif
};
示例2: ProcessFile
void ProcessFile(const string &filein)
{
ifstream in;
in.open(filein);
string str;
while(!in.eof())
{
getline(in,str);
if(str.find("#include ") == str.npos) continue;
string s = str.substr(10,str.size() - 11);
if(!headfile.count(s));
{
headfile.push_back(s);
ProcessFile(s);
}
else throw "Self-referential includes is detected:"<<s<<endl;
}
示例3: permuteRepate2
//with repeat
void permuteRepate2(char *s, int swapIndex, int end)
{
// printf("%d %d\n", swapIndex, end);
if(swapIndex == end)
{
if(stringPermute.find())
{
sums++;
printf("%s\n", s);
char *news = new char[N];
memcpy(news, s, N*sizeof(char));
stringPermute.push_back(news);
}
return;
}
for (int i = swapIndex; i <= end; ++i)
{
swap(s[i], s[swapIndex]);
permute(s, swapIndex+1, end);
swap(s[i], s[swapIndex]);
}
}
示例4: main
int main(int argc, char* argv[])
{
setName("Scheduler");
registerInteraction(argc, argv);
int problemCount = inf.readInt();
int invokerCount = inf.readInt();
invokerFreeTime.clear();
for (int i = 0; i < invokerCount; i++) {
invokerFreeTime.push_back(0);
}
printf("%d\n", invokerCount);
problems.resize(problemCount);
for (int i = 0; i < problemCount; i++) {
int timeLimit = inf.readInt();
int testCount = inf.readInt();
if (testCount < 1) testCount = 1;
problems[i] = Problem(timeLimit, testCount);
}
printf("%d\n", problemCount);
for (int i = 0; i < problemCount; i++) {
printf("%d %d\n", problems[i].timeLimit, problems[i].testCount);
}
fflush(stdout);
submissions.clear();
while (true) {
int submitTime = inf.readInt();
if (submitTime == -1)
break;
int problemId = inf.readInt();
vector<Verdict> verdicts;
while (true) {
int timeConsumed = inf.readInt();
if (timeConsumed == -1)
break;
string verdictString = inf.readToken();
Verdict verdict;
verdict.timeConsumed = timeConsumed;
verdict.passed = verdictString == "OK";
verdicts.push_back(verdict);
}
if (!submissions.empty())
assert(submissions.back().submitTime <= submitTime);
submissions.push_back(Submission(submitTime, problemId, verdicts));
}
finishedCount = 0;
int submissionIndex = 0;
for (currentTime = 0; finishedCount != int(submissions.size()); currentTime += TIME_STEP) {
while (submissionIndex < int(submissions.size()) && submissions[submissionIndex].submitTime <= currentTime) {
Submission& submission = submissions[submissionIndex];
printf("%d\n", submission.problemId);
submission.startTime = currentTime;
submissionIndex++;
}
puts("-1");
while (!verdicts.empty() && verdicts.begin()->first.first <= currentTime) {
submissions[verdicts.begin()->second.first].judged[verdicts.begin()->second.second] = true;
checkFinished(submissions[verdicts.begin()->second.first]);
printf("%d %d %s\n", verdicts.begin()->second.first, verdicts.begin()->second.second,
verdicts.begin()->first.second ? "OK" : "RJ");
verdicts.erase(verdicts.begin());
}
puts("-1 -1");
fflush(stdout);
if (!readOperations() && finishedCount != int(submissions.size())) {
quitf(_wa, "Unexpected eof, not all submissions were judged");
}
}
const double k = 3;
double sumK = 0;
for (int i = 0; i < submissions.size(); i++) {
const Submission& submission = submissions[i];
int judgeTime = submission.timeConsumed;
sumK += pow(judgeTime, k);
}
tout << int(pow(sumK / submissions.size(), 1 / k)) << endl;
// just message
quitf(_ok, "Finished in %d ms", currentTime);
}