10474 - Where is the Marble?
C++语言: Codee#25814
01 /*
02 +++++++++++++++++++++++++++++++++++++++
03 author: chm
04 +++++++++++++++++++++++++++++++++++++++
05 */
06
07 #include <map>
08 #include <set>
09 #include <list>
10 #include <queue>
11 #include <cmath>
12 #include <stack>
13 #include <bitset>
14 #include <cstdio>
15 #include <cctype>
16 #include <string>
17 #include <vector>
18 #include <cassert>
19 #include <cstdlib>
20 #include <cstring>
21 #include <fstream>
22 #include <sstream>
23 #include <iomanip>
24 #include <iostream>
25 #include <algorithm>
26
27 using namespace std;
28
29 FILE* fin = stdin;
30 FILE* fout = stdout;
31 const int max_size = 10086;
32
33 int buf[max_size];
34 int main()
35 {
36 #ifndef ONLINE_JUDGE
37 freopen("c:\\in.txt", "r", stdin);
38 fout = fopen("c:\\garage\\out.txt", "w");
39 #endif
40 int n, qry;
41 int sq = 1;
42 while(scanf("%d%d", &n, &qry) && !(!n && !qry))
43 {
44 for(int i = 0; i < n; ++i)
45 scanf("%d", &buf[i]);
46 sort(buf, buf + n);
47
48 fprintf(fout, "CASE# %d:\n", sq++);
49 for(int j = 0; j < qry; ++j)
50 {
51 int tmp;
52 scanf("%d", &tmp);
53 int* ptr = find(buf, buf + n, tmp);
54 if(ptr == buf + n)
55 fprintf(fout, "%d not found\n", tmp);
56 else
57 fprintf(fout, "%d found at %d\n", tmp, ptr - buf + 1);
58 }
59 }
60
61
62
63 #ifndef ONLINE_JUDGE
64 fclose(fout);
65 system("c:\\garage\\check.exe");
66 system("notepad c:\\garage\\out.txt");
67 #endif
68 return 0;
69 }
02 +++++++++++++++++++++++++++++++++++++++
03 author: chm
04 +++++++++++++++++++++++++++++++++++++++
05 */
06
07 #include <map>
08 #include <set>
09 #include <list>
10 #include <queue>
11 #include <cmath>
12 #include <stack>
13 #include <bitset>
14 #include <cstdio>
15 #include <cctype>
16 #include <string>
17 #include <vector>
18 #include <cassert>
19 #include <cstdlib>
20 #include <cstring>
21 #include <fstream>
22 #include <sstream>
23 #include <iomanip>
24 #include <iostream>
25 #include <algorithm>
26
27 using namespace std;
28
29 FILE* fin = stdin;
30 FILE* fout = stdout;
31 const int max_size = 10086;
32
33 int buf[max_size];
34 int main()
35 {
36 #ifndef ONLINE_JUDGE
37 freopen("c:\\in.txt", "r", stdin);
38 fout = fopen("c:\\garage\\out.txt", "w");
39 #endif
40 int n, qry;
41 int sq = 1;
42 while(scanf("%d%d", &n, &qry) && !(!n && !qry))
43 {
44 for(int i = 0; i < n; ++i)
45 scanf("%d", &buf[i]);
46 sort(buf, buf + n);
47
48 fprintf(fout, "CASE# %d:\n", sq++);
49 for(int j = 0; j < qry; ++j)
50 {
51 int tmp;
52 scanf("%d", &tmp);
53 int* ptr = find(buf, buf + n, tmp);
54 if(ptr == buf + n)
55 fprintf(fout, "%d not found\n", tmp);
56 else
57 fprintf(fout, "%d found at %d\n", tmp, ptr - buf + 1);
58 }
59 }
60
61
62
63 #ifndef ONLINE_JUDGE
64 fclose(fout);
65 system("c:\\garage\\check.exe");
66 system("notepad c:\\garage\\out.txt");
67 #endif
68 return 0;
69 }