#10696: 編譯問題


vance5325 (vance)

學校 : 國立高雄應用科技大學
編號 : 55729
來源 : [180.177.3.45]
最後登入時間 :
2024-03-26 22:13:07
c085. 00350 - Pseudo-Random Numbers -- UVa350 | From: [49.215.16.178] | 發表日期 : 2016-02-13 10:53

/code_2694580.cpp: In function ‘int main()’:
/code_2694580.cpp:12:105: error: no matching function for call to ‘find(std::vector::iterator, std::vector::iterator, __gnu_cxx::__alloc_traits<std::allocator >::value_type)’
    vector::iterator findit = find(myvec.begin(), myvec.end(), (myvec[myvec.size() - 1] * z + i) % m);
                                                                                                         ^
/code_2694580.cpp:12:105: note: candidate is:
In file included from /usr/include/c++/4.9/bits/locale_facets.h:48:0,
                 from /usr/include/c++/4.9/bits/basic_ios.h:37,
                 from /usr/include/c++/4.9/ios:44,
                 from /usr/include/c++/4.9/ostream:38,
                 from /usr/include/c++/4.9/iostream:39,
                 from /code_2694580.cpp:1:
/usr/include/c++/4.9/bits/streambuf_iterator.h:369:5: note: template typename __gnu_cxx::__enable_if<std::__is_char::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&)

是這裡的編譯器不支援vector嗎?
在自己電腦編譯可過
求解

程式碼:
#include <iostream>
#include <vector>
using namespace std;

int main() {
int z, i, m, l, count = 1;
while (cin >> z >> i >> m >> l, z || i || m || l) {
vector<int>myvec;
myvec.push_back(l);
cout << "Case " << count << ": ";
while (1) {
vector<int>::iterator findit = find(myvec.begin(), myvec.end(), (myvec[myvec.size() - 1] * z + i) % m);
if (findit != myvec.end()) {
cout << myvec.end() - findit << endl;
break;
}
else myvec.push_back((myvec[myvec.size() - 1] * z + i) % m);
}
count++;
}
}
 
ZeroJudge Forum