<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="th">
	<id>http://158.108.32.49/wiki/index.php?action=history&amp;feed=atom&amp;title=Adt_lab%2Fstl_examples</id>
	<title>Adt lab/stl examples - ประวัติรุ่นแก้ไข</title>
	<link rel="self" type="application/atom+xml" href="http://158.108.32.49/wiki/index.php?action=history&amp;feed=atom&amp;title=Adt_lab%2Fstl_examples"/>
	<link rel="alternate" type="text/html" href="http://158.108.32.49/wiki/index.php?title=Adt_lab/stl_examples&amp;action=history"/>
	<updated>2026-04-20T13:46:37Z</updated>
	<subtitle>ประวัติรุ่นแก้ไขของหน้านี้ในวิกิ</subtitle>
	<generator>MediaWiki 1.33.1</generator>
	<entry>
		<id>http://158.108.32.49/wiki/index.php?title=Adt_lab/stl_examples&amp;diff=57268&amp;oldid=prev</id>
		<title>Jittat: หน้าที่ถูกสร้างด้วย &#039;: &#039;&#039;This is part of adt lab.&#039;&#039;  == vector and pair == &lt;syntaxhighlight lang=&quot;cpp&quot;&gt; #include &lt;vector&gt; #include &lt;iostream&gt; using name...&#039;</title>
		<link rel="alternate" type="text/html" href="http://158.108.32.49/wiki/index.php?title=Adt_lab/stl_examples&amp;diff=57268&amp;oldid=prev"/>
		<updated>2016-10-13T07:19:50Z</updated>

		<summary type="html">&lt;p&gt;หน้าที่ถูกสร้างด้วย &amp;#039;: &amp;#039;&amp;#039;This is part of &lt;a href=&quot;/wiki/index.php/Adt_lab&quot; title=&quot;Adt lab&quot;&gt;adt lab&lt;/a&gt;.&amp;#039;&amp;#039;  == vector and pair == &amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;lt;vector&amp;gt; #include &amp;lt;iostream&amp;gt; using name...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;หน้าใหม่&lt;/b&gt;&lt;/p&gt;&lt;div&gt;: &amp;#039;&amp;#039;This is part of [[adt lab]].&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== vector and pair ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
  vector&amp;lt;pair&amp;lt;int,int&amp;gt; &amp;gt; a;&lt;br /&gt;
&lt;br /&gt;
  for(int i=0; i&amp;lt;100000; i++) {&lt;br /&gt;
    int x = i;&lt;br /&gt;
    int y = i*2;&lt;br /&gt;
    a.push_back(make_pair(x,y));&lt;br /&gt;
  }&lt;br /&gt;
  long long s = 0;&lt;br /&gt;
  for(int i=0; i&amp;lt;100000; i++)&lt;br /&gt;
    s += a[i].first;&lt;br /&gt;
  &lt;br /&gt;
  cout &amp;lt;&amp;lt; a.size() &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; s &amp;lt;&amp;lt; endl;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== vector, pair, iterator ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
  vector&amp;lt;pair&amp;lt;int,int&amp;gt; &amp;gt; a;&lt;br /&gt;
&lt;br /&gt;
  for(int i=0; i&amp;lt;100000; i++) {&lt;br /&gt;
    int x = i;&lt;br /&gt;
    int y = i*2;&lt;br /&gt;
    a.push_back(make_pair(x,y));&lt;br /&gt;
  }&lt;br /&gt;
  long long s = 0;&lt;br /&gt;
  for(vector&amp;lt;pair&amp;lt;int,int&amp;gt; &amp;gt;::iterator i=a.begin();&lt;br /&gt;
      i != a.end(); i++) {&lt;br /&gt;
    s += i-&amp;gt;first;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  cout &amp;lt;&amp;lt; a.size() &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; s &amp;lt;&amp;lt; endl;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== set ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;set&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
  set&amp;lt;int&amp;gt; a;&lt;br /&gt;
&lt;br /&gt;
  a.insert(10);&lt;br /&gt;
  a.insert(200);&lt;br /&gt;
  a.insert(5);&lt;br /&gt;
  a.insert(45);&lt;br /&gt;
&lt;br /&gt;
  for(set&amp;lt;int&amp;gt;::iterator i = a.begin();&lt;br /&gt;
      i != a.end(); i++) {&lt;br /&gt;
    cout &amp;lt;&amp;lt; *i &amp;lt;&amp;lt; endl;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== set: id-request ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;set&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
  set&amp;lt;int&amp;gt; ids;&lt;br /&gt;
  int n;&lt;br /&gt;
&lt;br /&gt;
  cin &amp;gt;&amp;gt; n;&lt;br /&gt;
  for(int i=0; i&amp;lt;n; i++) {&lt;br /&gt;
    int id;&lt;br /&gt;
&lt;br /&gt;
    cin &amp;gt;&amp;gt; id;&lt;br /&gt;
    if(ids.find(id) != ids.end()) {&lt;br /&gt;
      cout &amp;lt;&amp;lt; &amp;quot;Y&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
    } else {&lt;br /&gt;
      cout &amp;lt;&amp;lt; &amp;quot;N&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
      ids.insert(id);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== map: like count ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;map&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
  map&amp;lt;int,int&amp;gt; like_count;&lt;br /&gt;
  int n;&lt;br /&gt;
&lt;br /&gt;
  cin &amp;gt;&amp;gt; n;&lt;br /&gt;
  for(int i=0; i&amp;lt;n; i++) {&lt;br /&gt;
    int id;&lt;br /&gt;
&lt;br /&gt;
    cin &amp;gt;&amp;gt; id;&lt;br /&gt;
    if(like_count.find(id) == like_count.end()) {&lt;br /&gt;
      like_count[id] = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
      like_count[id] += 1;&lt;br /&gt;
    }&lt;br /&gt;
    cout &amp;lt;&amp;lt; like_count[id] &amp;lt;&amp;lt; endl;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jittat</name></author>
		
	</entry>
</feed>