<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>涡の小屋</title><description>Home / 主页</description><link>https://blog.haoye.plus/</link><language>en</language><item><title>[猜盐] 是否猜国的最优解法</title><link>https://blog.haoye.plus/posts/guess_country/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/guess_country/</guid><description>二分二分二分二分</description><pubDate>Sun, 08 Feb 2026 00:00:00 GMT</pubDate><content:encoded>&lt;h1&gt;前言&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;猜&lt;/strong&gt;盐猜&lt;strong&gt;盐&lt;/strong&gt;猜盐&lt;strong&gt;猜&lt;/strong&gt;盐猜&lt;strong&gt;盐&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;最近沉迷猜盐无法自拔。做是否猜国的时候&lt;s&gt;作为一名蒟蒻OIer&lt;/s&gt;一下就想到了可以用二分来最小化最大提问次数，遂写此文。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;声明：本文所指的国家来源为猜盐上的&lt;a href=&quot;https://xiaoce.fun/q/5266&quot;&gt;世界上的国家&lt;/a&gt;，仅作为“是否猜国”的参考用，不代表本站任何立场。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1&gt;理论&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;问题描述&lt;/strong&gt;：在是否猜国中，你需要通过提出问题猜测一个国家，而AI会回答这个问题对于这个国家是正确的还是错误的（或者未知）。你也可以直接提出这个国家的名字。如果名字正确则直接结束。也就是说，一次对话有四个结果：是、否、正确和未知。&lt;/p&gt;
&lt;p&gt;本文只讨论&lt;strong&gt;是或否&lt;/strong&gt;的情况。&lt;/p&gt;
&lt;p&gt;（我试过在一次对话里面塞两个问题去利用正确和未知这两个状态来减少提问次数，可是不是很稳定。所以我们只讨论是否两种情况）&lt;/p&gt;
&lt;p&gt;注意到，对于n个对象二分的最大次数$T$ 为&lt;/p&gt;
&lt;p&gt;$$
T=\lceil \log_2 n \rceil
$$&lt;/p&gt;
&lt;p&gt;对197个国家进行二分的最大次数为 $\lceil \log_2 197 \rceil = 8$ 次。&lt;/p&gt;
&lt;p&gt;由于猜盐最后一次“正确”也算在次数内，所以实际上二分的&lt;strong&gt;最大提问数为9次&lt;/strong&gt;。&lt;/p&gt;
&lt;h1&gt;二分方法&lt;/h1&gt;
&lt;p&gt;根据以上的理论，我构建了一个可行的二分猜国的规则。&lt;/p&gt;
&lt;p&gt;为了简洁性，以下的树只列出了&lt;strong&gt;前五个问题&lt;/strong&gt;，把国家的范围缩小到8个以内。读者可以自行找出对剩下的国家进行二分的方法，或者直接复制一半的国家问AI答案在不在这里面。&lt;/p&gt;
&lt;p&gt;任何&lt;strong&gt;错误/更优雅的方法&lt;/strong&gt;也请各位评论指出{{{(&amp;gt;_&amp;lt;)}}}&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;我们开始吧！(=^^)///&lt;/strong&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;亚欧 (92)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;大部分国土位于亚洲（包括俄罗斯） (49)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;中/西亚 (23)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;阿拉伯国家 (12)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;三个字 (6)&lt;/strong&gt;
：&lt;em&gt;伊拉克/科威特/黎巴嫩/阿联酋/卡塔尔/叙利亚&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非三个字 (6)&lt;/strong&gt;
：&lt;em&gt;约旦/巴勒斯坦/沙特阿拉伯/也门/阿曼/巴林&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;不是阿拉伯国家 (11)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;中亚(5)&lt;/strong&gt;
：&lt;em&gt;哈萨克斯坦/塔吉克斯坦/乌兹别克斯坦/吉尔吉斯斯坦/土库曼斯坦&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;西亚(6)&lt;/strong&gt;
：&lt;em&gt;以色列/土耳其/塞浦路斯/格鲁吉亚/亚美尼亚/阿塞拜疆&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;东/东南/南/北亚(26)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;东南亚 (11)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;两个字（不包括印尼）(5)&lt;/strong&gt;
：&lt;em&gt;缅甸/老挝/越南/泰国/文莱&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;两个字以上（包括印度尼西亚）(6)&lt;/strong&gt;
：&lt;em&gt;柬埔寨/印度尼西亚/马来西亚/东帝汶/菲律宾/新加坡&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;东/南/北亚 (15)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;两个字 (8)&lt;/strong&gt;
：&lt;em&gt;中国/蒙古/朝鲜/韩国/日本/伊朗/印度/不丹&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;三个字及以上 (7)&lt;/strong&gt;
：&lt;em&gt;斯里兰卡/马尔代夫/巴基斯坦/孟加拉国/尼泊尔/阿富汗/俄罗斯&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;大部分国土位于欧洲（不包括俄罗斯）(43)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;欧盟(27)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;名字结尾为牙/亚/兰/利 (15)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;名字结尾为牙/亚(8)&lt;/strong&gt;
：&lt;em&gt;西班牙/葡萄牙/斯洛文尼亚/克罗地亚/罗马尼亚/保加利亚/爱沙尼亚/拉脱维亚&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;名字结尾为兰/利(7)&lt;/strong&gt;
：*荷兰/波兰/芬兰/爱尔兰/意大利/匈牙利/奥地利 *&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;名字结尾不为以上的字 (12)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;两个字 (6)&lt;/strong&gt;
：&lt;em&gt;捷克/丹麦/希腊/瑞典/德国/法国&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;三或四个字 (6)&lt;/strong&gt;
：&lt;em&gt;比利时/卢森堡/马耳他/立陶宛/斯洛伐克/塞浦路斯&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非欧盟(16)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;巴尔干半岛/东欧(8)&lt;/strong&gt;
：&lt;em&gt;塞尔维亚/北马其顿/波黑/黑山/阿尔巴尼亚/白俄罗斯/乌克兰/摩尔多瓦&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非巴尔干半岛/东欧(8)&lt;/strong&gt;
：&lt;em&gt;冰岛/英国/挪威/瑞士/安道尔/列支敦士登/圣马力诺/梵蒂冈&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非亚欧(105)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;非洲(54)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;北/东部非洲 (24)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;阿拉伯国家联盟成员国 (9)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;三个字 (6)&lt;/strong&gt;
：&lt;em&gt;利比亚/摩洛哥/突尼斯/吉布提/索马里/科摩罗&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非三个字(3)&lt;/strong&gt;
：&lt;em&gt;阿尔及利亚/埃及/苏丹&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非阿拉伯国家联盟成员国 (15)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;三个字 (8)&lt;/strong&gt;
：&lt;em&gt;肯尼亚/乌干达/卢旺达/布隆迪/赞比亚/马拉维/南苏丹/塞舌尔&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非三个字 (7)&lt;/strong&gt;
：&lt;em&gt;埃塞俄比亚/厄立特里亚/马达加斯加/坦桑尼亚/津巴布韦/毛里求斯/莫桑比克&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;中/西/南部非洲 (30)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;西部非洲(16)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;两/三个字 (8)&lt;/strong&gt;
：&lt;em&gt;马里/加纳/多哥/贝宁/尼日尔/佛得角/几内亚/冈比亚&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;四/五个字 (8)&lt;/strong&gt;
：&lt;em&gt;塞内加尔/塞拉利昂/利比里亚/科特迪瓦/尼日利亚/几内亚比绍/布基纳法索/毛里塔尼亚&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;中/南部非洲(14)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;两/四个字 (7)&lt;/strong&gt;
：&lt;em&gt;乍得/中非/加蓬/南非/纳米比亚/博茨瓦纳/斯威士兰&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非两/四个字(7)&lt;/strong&gt;
：&lt;em&gt;莱索托/刚果金/刚果布/安哥拉/喀麦隆/赤道几内亚/圣多美和普林西比&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;南北美/大洋 (51)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;北/中美洲（包括巴拿马）(23)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;岛国 (13)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;四个字 (5)&lt;/strong&gt;
：&lt;em&gt;多米尼加/多米尼克/圣卢西亚/巴巴多斯/格林纳达&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非四个字 (8)&lt;/strong&gt;
：&lt;em&gt;古巴/海地/牙买加/巴哈马/圣基茨和尼维斯/安提瓜和巴布达/圣文森特和格林纳丁斯/特立尼达和多巴哥&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非岛国 (10)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;两/三个字 (5)&lt;/strong&gt;
：&lt;em&gt;美国/加拿大/墨西哥/伯利兹/巴拿马&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;四/五个字 (5)&lt;/strong&gt;
：&lt;em&gt;危地马拉/萨尔瓦多/洪都拉斯/尼加拉瓜/哥斯达黎加&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;南美洲/大洋洲 (28)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;南美（不包括巴拿马）(12)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;三个字 (5)&lt;/strong&gt;
：&lt;em&gt;阿根廷/苏里南/乌拉圭/巴拉圭/圭亚那&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;二/四个字 (7)&lt;/strong&gt;
：&lt;em&gt;巴西/智利/秘鲁/委内瑞拉/哥伦比亚/厄瓜多尔/玻利维亚&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;大洋(16)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;二/三个字 (8)&lt;/strong&gt;
：&lt;em&gt;帕劳/斐济/汤加/瑙鲁/纽埃/图瓦卢/萨摩亚/新西兰&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;四个字及以上 (8)&lt;/strong&gt;
：&lt;em&gt;澳大利亚/巴布亚新几内亚/密克罗尼西亚联邦/马绍尔群岛/基里巴斯/所罗门群岛/瓦努阿图/库克群岛&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;注&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;地理区划原则&lt;/strong&gt;：联合国地理区划&lt;/p&gt;
&lt;p&gt;所以伊朗和阿富汗属于&lt;strong&gt;南亚&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;名字&lt;/strong&gt;：国家常用称呼&lt;/p&gt;
&lt;p&gt;法兰西第五共和国❌ 法国✅&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;有的时候猜盐的判定很谜，所以实际运用这个方法的时候可能会比最优解更少或者更多。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;misjudge.png&quot; alt=&quot;神秘判定&quot; /&gt;&lt;/p&gt;
&lt;p&gt;实战：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;example.png&quot; alt=&quot;二分方法实战演示&quot; /&gt;&lt;/p&gt;
</content:encoded></item><item><title>记 2025 SCIE 1024 Coding Challenge</title><link>https://blog.haoye.plus/posts/1024/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/1024/</guid><description>也是完赛了呢</description><pubDate>Tue, 28 Oct 2025 00:00:00 GMT</pubDate><content:encoded>&lt;h1&gt;关于比赛&lt;/h1&gt;
&lt;p&gt;本届 SCIE 1024 程序员节活动由 M&amp;amp;CS Club 和 SCIE MLxAI 两个社团联合举办，设有两条赛道，算法和机器学习。我参加了算法的比赛，AK并取得了第二的成绩~&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;rank_competition.jpg&quot; alt=&quot;名次&quot; /&gt;&lt;/p&gt;
&lt;p&gt;此次比赛从周五下午的八点开始，持续两天。可以说时间非常充足了&lt;/p&gt;
&lt;p&gt;比赛题目pdf可 &lt;a href=&quot;https://image.haoye.plus/file/1024_Problem_Statements.pdf&quot;&gt;点击此处下载&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;题目思路&lt;/h1&gt;
&lt;p&gt;以下是我的解题思路和对题目评价/吐槽（有些比较简单的就写得比较少）&lt;/p&gt;
&lt;p&gt;Enjoy~&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;CR(字典序) : Alex Liu, Allen Xu, Alvin, CQR, Tiger Shu&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;A~D&lt;/h2&gt;
&lt;p&gt;水题略&lt;/p&gt;
&lt;h2&gt;E (T5)&lt;/h2&gt;
&lt;p&gt;结合了课内FDE Cycle的模拟题，让人眼前一亮。但测试样例有点少，对于循环次数和报错 &lt;code&gt;CRASH&lt;/code&gt; 的说明不够清晰，debug到自闭😭&lt;/p&gt;
&lt;h2&gt;F (T6)&lt;/h2&gt;
&lt;p&gt;一道搜索题。用双向BFS优化了下速度，写了个简单的哈希表来标记已访问的图&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;

struct grid{
    int grid[3][3];
    bool side;
};

int prime[9] = {2,3,5,7,11,13,17,19,23}; // Hash
int hash_grid(grid x){
    unsigned long long res = 0;
    for(int i=0;i&amp;lt;3;i++){
        for(int j=0;j&amp;lt;3;j++){
            res += prime[i*3+j]*x.grid[i][j];
        }
    }
    return res % 114514;
}

struct node{
    grid x;
    vector&amp;lt;int&amp;gt; o;
};

vector&amp;lt;node&amp;gt; visited[114514];
queue&amp;lt;node&amp;gt; ss, ee;

bool comp(grid a, grid b){
    bool res = false;
    for(int i=0;i&amp;lt;3;i++){
        for(int j=0;j&amp;lt;3;j++){
            if(a.grid[i][j] != b.grid[i][j])return false;
        }
    }
    return true;
}

bool searched(node x){
    int hashed = hash_grid(x.x);
    if(empty(visited[hashed]))return false;
    for(int i=0;i&amp;lt;visited[hashed].size();i++){
        if(comp(x.x, visited[hashed][i].x)){
            return true;
        }
    }
    return false;
}

node searched_grid(node x){
    int hashed = hash_grid(x.x);
    for(int i=0;i&amp;lt;visited[hashed].size();i++){
        if(comp(x.x, visited[hashed][i].x)){
            return visited[hashed][i];
        }
    }
}

void search(node x){
    visited[hash_grid(x.x)].push_back(x);
}

int step[4][2] = {{0,0},{0,1},{1,0},{1,1}};
node spin(node x, int opt){
    int i = step[opt][0];
    int j = step[opt][1];
    int cache = x.x.grid[i][j];
    x.x.grid[i][j] = x.x.grid[i+1][j];
    x.x.grid[i+1][j] = x.x.grid[i+1][j+1];
    x.x.grid[i+1][j+1] = x.x.grid[i][j+1];
    x.x.grid[i][j+1] = cache;
    return x;
}

node spinrev(node x, int opt){
    int i = step[opt][0];
    int j = step[opt][1];
    int cache = x.x.grid[i][j];
    x.x.grid[i][j] = x.x.grid[i][j+1];
    x.x.grid[i][j+1] = x.x.grid[i+1][j+1];
    x.x.grid[i+1][j+1] = x.x.grid[i+1][j];
    x.x.grid[i+1][j] = cache;
    return x;
}

void output_node(node x){
    cout&amp;lt;&amp;lt;x.x.side&amp;lt;&amp;lt;&quot;:&quot;;
    for(int i=0;i&amp;lt;x.o.size();i++)cout&amp;lt;&amp;lt;x.o[i]&amp;lt;&amp;lt;&apos;,&apos;;
    cout&amp;lt;&amp;lt;endl;
    for(int i=0;i&amp;lt;3;i++){
        for(int j=0;j&amp;lt;3;j++){
            cout&amp;lt;&amp;lt;x.x.grid[i][j]&amp;lt;&amp;lt;&apos; &apos;;
        }
        cout&amp;lt;&amp;lt;endl;
    }
    cout&amp;lt;&amp;lt;&quot;-------&quot;&amp;lt;&amp;lt;endl;
}

string code = &quot;ABCDXXXXXX&quot;;
int main(){
    node start;
    for(int i=0;i&amp;lt;3;i++){
        for(int j=0;j&amp;lt;3;j++){
            start.x.grid[i][j] = i*3+j+1;
        }
    }
    start.x.side = true;

    node end;
    for(int i=0;i&amp;lt;3;i++){
        for(int j=0;j&amp;lt;3;j++){
            cin&amp;gt;&amp;gt;end.x.grid[i][j];
        }
    }
    end.x.side = false;
    ss.push(start);ee.push(end);

    vector&amp;lt;node&amp;gt; ans;
    bool STOP = false;
    int count = 0;

    while(!STOP){ // BFS
        node s_top = ss.front(); // From the start
        ss.pop();
        for(int opt=0;opt&amp;lt;4;opt++){
            node cc = spin(s_top, opt);
            cc.o = s_top.o;
            cc.o.push_back(opt);

            if(searched(cc)){
                node awa = searched_grid(cc);
                if(awa.x.side == true){ // Same side
                    continue;
                }else{ /////ANSWER!!
                    ans.push_back(cc);
                    ans.push_back(awa);
                    STOP = true;
                    break;
                }
            }
            search(cc);
            ss.push(cc);
        }
        
        if(STOP)break;

        node e_top = ee.front(); // From the end
        ee.pop();

        for(int opt=0;opt&amp;lt;4;opt++){
            node cc = spinrev(e_top, opt); // Spin in reverse direction
            cc.o = e_top.o;
            cc.o.push_back(opt);

            if(searched(cc)){
                node awa = searched_grid(cc);
                if(awa.x.side == false){ // Same side
                    continue;
                }else{ /////ANSWER!!
                    ans.push_back(awa);
                    ans.push_back(cc);
                    STOP = true;
                    break;
                }
            }
            search(cc);
            ee.push(cc);
        }

        if(STOP)break;
    }

    cout&amp;lt;&amp;lt;&quot;YES&quot;&amp;lt;&amp;lt;endl;
    for(int i=0;i&amp;lt;ans[0].o.size();i++){
        cout&amp;lt;&amp;lt;code[ans[0].o[i]];
    }
    for(int i=ans[1].o.size()-1;i&amp;gt;=0;i--){
        cout&amp;lt;&amp;lt;code[ans[1].o[i]];
    }
    cout&amp;lt;&amp;lt;endl;

    return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;G (T7)&lt;/h2&gt;
&lt;p&gt;刚开始看到有图以为这也是一道搜索题，写了个深搜，TLE之后就去做别的题了。后面才发现其实有更巧妙的解法&lt;/p&gt;
&lt;p&gt;考虑一个 $k$，使得所有边权包含 $2^k$ 的边可以&lt;strong&gt;让起点和终点联通&lt;/strong&gt;（包含：指 $w&amp;amp;2^k=1$ ）。那么，当 $k$ 取最大时，&lt;strong&gt;最终答案的路径&lt;/strong&gt;一定取自这些包含 $2^k$ 的边。证明如下：&lt;/p&gt;
&lt;p&gt;因为结果是按位与出来的，&lt;strong&gt;不连通&lt;/strong&gt;就意味着&lt;strong&gt;按位与后为0&lt;/strong&gt;，取不到这一位，所以答案一定不来自包含&lt;strong&gt;大于&lt;/strong&gt; $2^k$ 的边。而如果答案来自包含&lt;strong&gt;小于&lt;/strong&gt;$2^k$的边，那么它们所构成的答案肯定&lt;strong&gt;不包含&lt;/strong&gt; $2^k$ ，就会比我们用包含 $2^k$ 的边所构建出的答案&lt;strong&gt;更小&lt;/strong&gt;，不满足最大化&lt;/p&gt;
&lt;p&gt;所以，我们可以从最高位往下找 $k$ 。每次找到一个可以让起点和终点联通的边时，&lt;strong&gt;删除&lt;/strong&gt;其他所有的边，只&lt;strong&gt;保留&lt;/strong&gt;包含 $2^k$ 的边。记录一路上符合条件的 $2^k$ 的和，我们就可以得到&lt;strong&gt;最终的答案&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;判断是否联通的话可以使用&lt;strong&gt;并查集&lt;/strong&gt;。每次初始化后添加没有被删除的边，然后就可以判断起点和终点是否被联通&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
#define MAX 200009
#define int long long

int n, m;
int valid[MAX];

struct line{
    int from;
    int to;
    int val;
}lines[MAX];
int lines_tot;


void pushline(int a, int b, int val){
    lines[lines_tot].from = a;
    lines[lines_tot].to = b;
    lines[lines_tot].val = val;
    valid[lines_tot] = true;
    lines_tot++;
}

int bcj[MAX];

void bcj_init(){
    for(int j=0;j&amp;lt;=n;j++){
        bcj[j] = j;
    }
}

int bcj_find(int k){
    if(bcj[k] == k)return k;
    bcj[k] = bcj_find(bcj[k]);
    return bcj[k];
}

void bcj_merge(int a, int b){
    a = bcj_find(a); b = bcj_find(b);
    bcj[a] = b;
}

signed main(){ // n&amp;gt;300
    cin&amp;gt;&amp;gt;n&amp;gt;&amp;gt;m;
    for(int i=0;i&amp;lt;m;i++){
        int a,b,val;
        cin&amp;gt;&amp;gt;a&amp;gt;&amp;gt;b&amp;gt;&amp;gt;val;
        pushline(a,b,val);
    }

    int ans = 0;
    for(int k=30;k&amp;gt;=0;k--){
        bcj_init();
        for(int i=0;i&amp;lt;lines_tot;i++){
            if(valid[i]&amp;amp;&amp;amp;(lines[i].val &amp;amp; (1&amp;lt;&amp;lt;k))){
                bcj_merge(lines[i].from, lines[i].to);
            }
        }
        if(bcj_find(1) == bcj_find(n)){ // If available
            ans += (1&amp;lt;&amp;lt;k);
            for(int i=0;i&amp;lt;lines_tot;i++){
                if(!(lines[i].val &amp;amp; (1&amp;lt;&amp;lt;k))){
                    valid[i] = false; // Disable the edge
                }
            }
        }
    }
    cout&amp;lt;&amp;lt;ans;
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;H (T8)&lt;/h2&gt;
&lt;p&gt;一道很板子的树形dp&lt;/p&gt;
&lt;p&gt;对于每棵子树，我们都可以分为两种情况：它的祖先没有进行翻转和进行了翻转（翻转：指操作2，翻转子树）（如果偶数个祖先都翻转了，则视为没有翻转，奇数同理）。所以我们可以在每个节点维护两个值 &lt;code&gt;ans[0]&lt;/code&gt; 和 &lt;code&gt;ans[1]&lt;/code&gt; ，分别代表在它的祖先不翻转和翻转的情况下，这棵子树需要多少次操作才能让这个子树都变为正常&lt;/p&gt;
&lt;p&gt;也就是说：&lt;/p&gt;
&lt;p&gt;对于&lt;strong&gt;叶子节点&lt;/strong&gt;来说，如果祖先没有翻转 &lt;code&gt;ans[0]&lt;/code&gt; ，那么当它被损坏时操作次数为1，否则为0. 如果祖先翻转了 &lt;code&gt;ans[1]&lt;/code&gt; ，那么就反过来&lt;/p&gt;
&lt;p&gt;对于&lt;strong&gt;非叶子节点&lt;/strong&gt;来说，我们可以分类讨论一下&lt;/p&gt;
&lt;p&gt;记我自身的状态为 &lt;code&gt;status&lt;/code&gt;（损坏为0，正常为1）,也就是说我没被祖先翻转的操作次数为 &lt;code&gt;!status&lt;/code&gt; ，被翻转后的操作次数为 &lt;code&gt;status&lt;/code&gt; ，则&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;祖先&lt;strong&gt;没有翻转&lt;/strong&gt;（求 &lt;code&gt;ans[0]&lt;/code&gt; ）：
&lt;ul&gt;
&lt;li&gt;我&lt;strong&gt;不翻转&lt;/strong&gt;，结果为我改变自己的操作次数 &lt;code&gt;!status&lt;/code&gt; ，加上子节点们不翻转 &lt;code&gt;ans[0]&lt;/code&gt; 的操作次数&lt;/li&gt;
&lt;li&gt;我&lt;strong&gt;翻转&lt;/strong&gt;，结果为我翻转后改变自己的操作次数 &lt;code&gt;status&lt;/code&gt; ，加上子节点们翻转 &lt;code&gt;ans[1]&lt;/code&gt; 的操作次数，再加上我翻转产生的操作次数1&lt;/li&gt;
&lt;li&gt;最后， &lt;code&gt;ans[0]&lt;/code&gt; 为两者的&lt;strong&gt;最小值&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;祖先&lt;strong&gt;翻转&lt;/strong&gt;了（求 &lt;code&gt;ans[1]&lt;/code&gt; ）：
&lt;ul&gt;
&lt;li&gt;我&lt;strong&gt;不翻转&lt;/strong&gt;，结果为祖先翻转后我改变自己的操作次数 &lt;code&gt;status&lt;/code&gt; ，加上子节点们翻转 &lt;code&gt;ans[1]&lt;/code&gt; 的操作次数&lt;/li&gt;
&lt;li&gt;我&lt;strong&gt;翻转&lt;/strong&gt;，两个翻转产生的效果抵消，结果为我改变自己的操作次数 &lt;code&gt;!status&lt;/code&gt; ，加上子节点们不翻转 &lt;code&gt;ans[0]&lt;/code&gt; 的操作次数，再加上我翻转产生的操作次数1&lt;/li&gt;
&lt;li&gt;最后， &lt;code&gt;ans[1]&lt;/code&gt; 为两者的&lt;strong&gt;最小值&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;后序遍历整个树，从下到上更新每个节点的&lt;code&gt;ans&lt;/code&gt;，最后的答案就为根节点不翻转 &lt;code&gt;ans[0]&lt;/code&gt; 和根节点翻转 &lt;code&gt;ans[1]&lt;/code&gt; 加1的最小值&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Talk is cheap, show me the code.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
#define MAX 100009

struct node{
    vector&amp;lt;int&amp;gt; sons;
    int ans[2];
}tree[MAX];

bool status[MAX];
void dp(int k){
    // Leaf
    if(tree[k].sons.empty()){
        tree[k].ans[0] = !status[k];
        tree[k].ans[1] = status[k];
        return;
    }
    // Not Leaf
    int tot = 0;
    int tot_inv = 0;
    for(int i = 0; i &amp;lt; tree[k].sons.size(); i ++){
        dp(tree[k].sons[i]);
        tot += tree[tree[k].sons[i]].ans[0];
        tot_inv += tree[tree[k].sons[i]].ans[1];
    }
    tree[k].ans[0] = min(!status[k] + tot, status[k] + tot_inv + 1);
    tree[k].ans[1] = min(status[k] + tot_inv, !status[k] + tot + 1);
}

int main(){
    int n;
    cin&amp;gt;&amp;gt;n;
    for(int i = 1;i &amp;lt;= n; i++){
        cin&amp;gt;&amp;gt;status[i];
    }

    for(int i = 1; i &amp;lt; n; i ++){
        int a, b;
        cin&amp;gt;&amp;gt;a&amp;gt;&amp;gt;b;
        tree[a].sons.push_back(b);
    }

    dp(1);

    cout&amp;lt;&amp;lt;min(tree[1].ans[0], tree[1].ans[1]+1); // Answer
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;I (T9)&lt;/h2&gt;
&lt;p&gt;3操作本质上是对x, y上的状态进行反转，总和不变&lt;/p&gt;
&lt;p&gt;反转后原本的放置地雷变为删除地雷，删除地雷变为放置地雷。注意如果原本没有雷的情况下不能删除，有雷的情况下无法放置&lt;/p&gt;
&lt;p&gt;而和的话，对于&lt;strong&gt;放置&lt;/strong&gt;操作，则要添加这个雷周围的&lt;strong&gt;空位&lt;/strong&gt;的数量，删除周围&lt;strong&gt;雷&lt;/strong&gt;的数量（挡住了它的一个格子）。如果是&lt;strong&gt;删除&lt;/strong&gt;的话，删除周围&lt;strong&gt;空位&lt;/strong&gt;的数量后，也需要考虑周围&lt;strong&gt;雷&lt;/strong&gt;的数量，重新加到和里面（释放一个格子给周围的雷）&lt;/p&gt;
&lt;p&gt;对于雷的存储和查找，我维护了一个动态的二维数组。存储是线性复杂度，更常用的查找只有对数复杂度&lt;/p&gt;
&lt;p&gt;注：&lt;code&gt;erfen&lt;/code&gt; 指普通的二分，找不到返回-1。&lt;code&gt;kind_erfen&lt;/code&gt; 指找到第一个大于此数的位置&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
#define ull unsigned long long
int n, m;
int x, y;
bool inverted = false;
bool current = false;
ull ans;

vector&amp;lt;int&amp;gt; dataa[1000009];
vector&amp;lt;bool&amp;gt; exists[1000009];

short erfen(int val, int row){ // return -1 if not found
    int mid;
    int l = 0, r = dataa[row].size();

    while(l&amp;lt;r){
        mid = (l+r)&amp;gt;&amp;gt;1;
        if(dataa[row][mid] &amp;gt;= val){
            r = mid;
        }
        else{
            l = mid + 1;
        }
    }
    if(l &amp;gt;= dataa[row].size() || dataa[row][l] != val){
        return -1;
    }
    return l;
}

short kind_erfen(int val, int row){ // return value greater than
    int mid;
    int l = 0, r = dataa[row].size();

    while(l&amp;lt;r){
        mid = (l+r)&amp;gt;&amp;gt;1;
        if(dataa[row][mid] &amp;gt;= val){
            r = mid;
        }
        else{
            l = mid + 1;
        }
    }
    return l;
}


bool valid(int x, int y){
    if(x&amp;lt;0||y&amp;lt;0||x&amp;gt;=n||y&amp;gt;=n)return false;
    return true;
}

bool query(int x, int y){
    if(!valid(x, y)){
        return false;
    }
    int pos = erfen(y, x);
    if(pos == -1){
        return false;
    }
    if(exists[x][pos] == false){
        return false;
    }
    return true;
    
}

void push(int x, int y){
    short pos = kind_erfen(y, x);
    dataa[x].push_back(0);
    exists[x].push_back(false);
    for(int i = dataa[x].size()-1; i &amp;gt; pos ; i--){
        dataa[x][i] = dataa[x][i-1];
        exists[x][i] = exists[x][i-1];
    }
    dataa[x][pos] = y;
    exists[x][pos] = true;
}

void pop(int x, int y){
    int pos = erfen(y, x);
    exists[x][pos] = false;
}

short step[8][2] = {{1,-1},{1,0},{1,1},{0,-1},{0,1},{-1,-1},{-1,0},{-1,1}};
void contribute(int x, int y){
    for(int k=0;k&amp;lt;8;k++){
        x += step[k][0]; y += step[k][1];
        if(valid(x, y)){
            bool ouo = query(x, y);
            ans += (!query(x, y))*(current?-1:1) + (query(x, y))*(current?1:-1);
        }
        x -= step[k][0]; y -= step[k][1];
    }
}

void rr(int x, int y){
    if(current){
        pop(x, y);
    }
    else{
        push(x, y);
    }
    contribute(x, y);
}

inline void add(int x, int y){
    current = query(x, y);
    if(inverted &amp;amp;&amp;amp; !current || !inverted &amp;amp;&amp;amp; current){
        return; // No change
    }
    rr(x, y);
}

inline void remove(int x, int y){
    current = query(x, y);
    if(inverted &amp;amp;&amp;amp; current || !inverted &amp;amp;&amp;amp; !current){
        return; // No change
    }
    rr(x, y);
}

inline void reverse(int x, int y){
    current = query(x, y);
    rr(x, y);
}

int main(){
    cin&amp;gt;&amp;gt;n&amp;gt;&amp;gt;m;
    while(m--){
        int opt;
        cin&amp;gt;&amp;gt;opt;
        switch (opt){
            case 1:{
                cin&amp;gt;&amp;gt;x&amp;gt;&amp;gt;y;
                x--;y--;
                add(x, y);
            }break;
            case 2:{
                cin&amp;gt;&amp;gt;x&amp;gt;&amp;gt;y;
                x--;y--;
                remove(x, y);
            }break;
            case 3:{
                cin&amp;gt;&amp;gt;x&amp;gt;&amp;gt;y;
                x--;y--;
                inverted = !inverted;
                reverse(x, y);
            }break;
            case 4:{
                cout&amp;lt;&amp;lt;ans&amp;lt;&amp;lt;endl;
            }break;
            default:break;
        }
    }
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;J (T10)&lt;/h2&gt;
&lt;p&gt;博弈论，在 $m \geq 32$ 后开始以八行为一组循环。有一个20以后的组合比较难想，最后写了个模拟把这个爆出来了&lt;/p&gt;
&lt;p&gt;不过多评价，这种题就要享受自己构建可行方案解题的乐趣（嗯嗯）&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
#define int long long
int remainder[9] = {0, 0, 0, 4, 4, 4, 6, 7};

signed main(){
    int T;
    cin&amp;gt;&amp;gt;T;
    while(T--){
        int a;
        cin&amp;gt;&amp;gt;a;
        cout&amp;lt;&amp;lt;(remainder[a%8] + (a / 8) * 4  - 2*(a%8==7&amp;amp;&amp;amp;a&amp;gt;10) - (a&amp;gt;=30&amp;amp;&amp;amp;a%8==6))&amp;lt;&amp;lt;endl;
    }
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;K (T11)&lt;/h2&gt;
&lt;p&gt;从第 &lt;code&gt;i&lt;/code&gt; 堆卡牌中进行 &lt;code&gt;j&lt;/code&gt; 次抽取操作所贡献的能力值相当于求出从 1 到 &lt;code&gt;j+1&lt;/code&gt; 的&lt;strong&gt;和&lt;/strong&gt;并减去其中的&lt;strong&gt;最小值&lt;/strong&gt;。所以我们可以预先计算出这个贡献的能力值 &lt;code&gt;chooce[i][j]&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;从第一堆卡牌开始，考虑从第0堆到第 &lt;code&gt;i&lt;/code&gt; 堆中抽取 &lt;code&gt;card&lt;/code&gt; 个卡片可以取得的最大能力值 &lt;code&gt;dp[i][card]&lt;/code&gt; 。我们在第 &lt;code&gt;i&lt;/code&gt; 堆拿 &lt;code&gt;num&lt;/code&gt; 个卡片，在第 0 到 &lt;code&gt;i-1&lt;/code&gt; 堆拿 &lt;code&gt;card-num&lt;/code&gt; 个卡片的话，所产生的能力值就为 &lt;code&gt;dp[i-1][card-num] + choose[i][num]&lt;/code&gt;。从0到n-1动态规划，答案为 &lt;code&gt;dp[n-1][...]&lt;/code&gt; 中的最大值&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
#define int unsigned long long
int n, m, k;
int datas[300][3000];
int choose[300][3000];
int dp[300][3000];
signed main(){
    cin&amp;gt;&amp;gt;n&amp;gt;&amp;gt;m&amp;gt;&amp;gt;k;
    
    for(int i=0;i&amp;lt;n;i++){
        int min_val = 114514;
        int tot = 0;
        for(int j=0;j&amp;lt;m;j++){
            cin&amp;gt;&amp;gt;datas[i][j];
            min_val = min(datas[i][j], min_val);
            tot += datas[i][j];

            if(j&amp;gt;=1)
            choose[i][j] = tot - min_val;
            dp[i][j] = choose[i][j];
            if(j==m-1){
                choose[i][m] = tot;
                dp[i][m] = tot;
            }
        }
    }

    for(int i = 1; i &amp;lt; n;i++){
        for(int card = 0; card &amp;lt;= k; card ++){
            for(int num = 0; num &amp;lt;= card &amp;amp;&amp;amp; num &amp;lt;= m; num ++){
                dp[i][card] = max(dp[i-1][card-num]+choose[i][num], dp[i][card]);
            }
        }
    }

    int res=0;
    for(int i=0;i&amp;lt;=k;i++){
        res = max(res, dp[n-1][i]);
    }
    cout&amp;lt;&amp;lt;res&amp;lt;&amp;lt;endl;
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;L (T12)&lt;/h2&gt;
&lt;p&gt;乍一看好像没什么头绪，我们可以一步一步分析&lt;/p&gt;
&lt;h3&gt;Step 1&lt;/h3&gt;
&lt;p&gt;如果题目的数据都是单调递增的话就很好了，所有的类型2的结果都是0。但如果数据有一段&lt;strong&gt;递减&lt;/strong&gt;的段落的话，我们希望它通过&lt;strong&gt;最少次数的翻倍操作&lt;/strong&gt;达成单调不递减。那么它所达成的单调不递减序列中一个元素一定在&lt;strong&gt;前一个元素&lt;/strong&gt;到&lt;strong&gt;其两倍&lt;/strong&gt;的范围之内，也就是说 $a_{i-1} \leq a_{i} &amp;lt; 2a_{i-1}$。这样的数组称为&lt;strong&gt;平滑的&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;对于一个数组 &lt;code&gt;a&lt;/code&gt; ，我们可以事先就构建出一个描述每个元素需要乘多少次2才能让整个数组 &lt;code&gt;a&lt;/code&gt; &lt;strong&gt;平滑&lt;/strong&gt;的数组 &lt;code&gt;b&lt;/code&gt;，之后每次查询的时候只用把每个元素所需要的次数 &lt;code&gt;b[i]&lt;/code&gt; 相加就可以了&lt;/p&gt;
&lt;p&gt;翻倍操作相当于减少这个元素所需要的翻倍次数，所以就把对应的 &lt;code&gt;b&lt;/code&gt; 减去一&lt;/p&gt;
&lt;p&gt;这是我刚开始的想法， &lt;s&gt;但第二个测试数据没过（。&lt;/s&gt; 后来发现虽然平滑的序列一定单调不递减，但单调不递减的序列&lt;strong&gt;不一定&lt;/strong&gt;平滑。换句话说，我们可以用比构造平滑序列&lt;strong&gt;更少&lt;/strong&gt;的次数来让序列不递减&lt;/p&gt;
&lt;p&gt;我们会发现，一个递增的序列（也就是 &lt;code&gt;b&lt;/code&gt; 递减）不需要参与计算。也就是说，我们要刨除序列中 &lt;code&gt;b&lt;/code&gt; 递减的部分，只保留增长的部分。于是，我们可以从头开始记录 &lt;code&gt;b[l]&lt;/code&gt; 到 &lt;code&gt;b[i]&lt;/code&gt; 的最小值。用当前的 &lt;code&gt;b[i]&lt;/code&gt; 剪掉这个最小值，得到的差累加起来就是最终的答案。图形化表示就是这样的：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;image.png&quot; alt=&quot;T12&quot; /&gt;&lt;/p&gt;
&lt;p&gt;我可能说的有一点绕（逃）。Anyway，在这里附上出题人 &lt;code&gt;Allen&lt;/code&gt; 大佬更为严谨的证明过程 (=^^) /&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;为了方便计数，我们定义第 $i$ 个数乘2的次数为 $e_i \in \mathbb{Z}_{\geq 0}$&lt;/p&gt;
&lt;p&gt;询问的目标是&lt;/p&gt;
&lt;p&gt;$$
\min \sum^r_{i=l+1}e_i \quad \mathrm{s.t.} \quad a_i \times 2^{e_i} \leq a_{i+1} \times 2^{e_{i+1}} \quad  (\forall i \in [l, r-1])
$$&lt;/p&gt;
&lt;p&gt;把相邻约束用指数差线性化。定义&lt;/p&gt;
&lt;p&gt;$$
c_i = \left\lceil \log_2 \frac{a_i}{a_{i-1}} \right\rceil \in \mathbb{Z} \quad (i \in [2, n])
$$&lt;/p&gt;
&lt;p&gt;则&lt;/p&gt;
&lt;p&gt;$$
a_i \times 2^{e_i} \leq a_{i+1} \times 2^{e_{i+1}} \Leftrightarrow e_{i+1} - e_i \geq c_i
$$&lt;/p&gt;
&lt;p&gt;于是目标函数可被重写为&lt;/p&gt;
&lt;p&gt;$$
\min \sum^r_{i=l+1} e_i \quad \mathrm{s.t.} \quad e_{i+1} - e_{i} \geq c_i, \quad e_i \geq 0
$$&lt;/p&gt;
&lt;p&gt;令前缀和&lt;/p&gt;
&lt;p&gt;$$
b_k = \sum^k_{i=1} c_i
$$&lt;/p&gt;
&lt;p&gt;容易得到我们最后的结论&lt;/p&gt;
&lt;p&gt;$$
\mathrm{Ans} (l, r) = \sum^r_{k=l+1} \left( b_k - \min_{t \in [l+1, k]} b_t \right)
$$&lt;/p&gt;
&lt;p&gt;（略有改动）&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;他的结论最小值是从 &lt;code&gt;l+1&lt;/code&gt; 开始算，而我的是从 &lt;code&gt;l&lt;/code&gt; 开始算。&lt;s&gt;不过我也懒得推为什么了大概意思差不多&lt;/s&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;总之！&lt;/strong&gt; 我们现在只需要算出每个元素 $b_i$ 减去它之前元素的最小值 $\min b_k, \enspace l\leq k&amp;lt;i$ 的和就可以了。&lt;/p&gt;
&lt;h3&gt;Step 2&lt;/h3&gt;
&lt;p&gt;剩下的话，我开了一个线段树维护 $b$ 的从 $l$ 到 $r$ 的&lt;strong&gt;最小值&lt;/strong&gt; &lt;code&gt;min&lt;/code&gt;，&lt;strong&gt;和&lt;/strong&gt; &lt;code&gt;sumr&lt;/code&gt; 还有&lt;strong&gt;答案&lt;/strong&gt; &lt;code&gt;summ&lt;/code&gt; ，类似于这样：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;image-3.png&quot; alt=&quot;Step 2_1&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;s&gt;（灵魂画手）&lt;/s&gt;&lt;/p&gt;
&lt;p&gt;最小值和总和的线段树求解比较简单就不赘述了。&lt;code&gt;summ&lt;/code&gt; 的意思是在此区间进行查询操作 &lt;code&gt;2&lt;/code&gt; 所返回的结果&lt;/p&gt;
&lt;p&gt;如果它的查询区间正好和线段树的区间重合，那就很简单了，直接返回 &lt;code&gt;summ&lt;/code&gt; ，如果没有，我们需要把这些答案累加起来，并加上一个&lt;strong&gt;偏移&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;偏移&lt;/strong&gt;为当区间左侧的最小值是 &lt;code&gt;val&lt;/code&gt; 的时候本区间还需要加多少操作次数，由 &lt;code&gt;bias()&lt;/code&gt; 这个函数求出。他会找到 &lt;code&gt;val&lt;/code&gt; 与这个区间的交点，并用 &lt;code&gt;(r-l+1)*val&lt;/code&gt; 的长方形剪掉 &lt;code&gt;summ&lt;/code&gt; 和 &lt;code&gt;sumr&lt;/code&gt; 的面积（也就是蓝色和橙色的面积），从而求得图中深蓝色的 &lt;code&gt;bias&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;image-4.png&quot; alt=&quot;Step 2_2&quot; /&gt;&lt;/p&gt;
&lt;p&gt;查询操作或者 &lt;code&gt;summ&lt;/code&gt; 的更新就是靠计算偏移来进行的。用&lt;strong&gt;左边区间的最小值&lt;/strong&gt;给&lt;strong&gt;右边区间&lt;/strong&gt;做偏移，最后汇总得到答案&lt;/p&gt;
&lt;p&gt;求偏移的时间复杂度是一个 $\log$，再算上查询的 $\log$，总的时间复杂度为 $O(n\log^2 n)$&lt;/p&gt;
&lt;p&gt;这道题算是这两年1024比赛最难的了（）非常考验选手对问题进行抽象概括，识别pattern，考虑边界情况，最终代码实现的能力 :spoiler[ （出题组太强了呜呜呜） ]&lt;/p&gt;
&lt;p&gt;以及代码：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;

#define int long long
#define inf 9223372036854775807
#define ls treee[k].lson
#define rs treee[k].rson
#define mid ((l+r)&amp;gt;&amp;gt;1)
#define MAX 100009

int n,q,a[MAX];
int b[MAX];

struct node{
    int lson, rson;
    int minn, summ;
    int sumr;
}treee[2*MAX];
int ttop;


int inittree(int l, int r){
    ttop++;
    int k = ttop;
    if(l==r)return k;
    ls = inittree(l,mid);
    rs = inittree(mid+1, r);
    return k;
}


int bias(int k, int l, int r, int val){
    if(l==r){
        return (treee[k].minn &amp;gt;= val) ? (treee[k].minn - val) : 0;
    }
    if(treee[k].minn &amp;gt;= val){
        return (treee[k].sumr - treee[k].summ) - (r-l+1)*val;
    }
    if(treee[ls].minn &amp;lt;= val){
        int bb = bias(ls, l, mid, val);
        return bb ;
    }else{
        int aa = (treee[ls].sumr - treee[ls].summ) - (mid-l+1)*val + bias(rs, mid+1, r, val) - bias(rs, mid+1, r, treee[ls].minn);
        return aa;
    }
}

void buildtree(int k, int l, int r){
    if(l==r){
        treee[k].minn = b[l];
        treee[k].sumr = b[l];
        return;
    }
    buildtree(ls, l, mid);
    buildtree(rs, mid+1, r);
    
    treee[k].minn = min(treee[ls].minn, treee[rs].minn);
    treee[k].summ = treee[ls].summ + treee[rs].summ;
    treee[k].sumr = treee[ls].sumr + treee[rs].sumr;
    treee[k].summ += bias(rs, mid+1, r, treee[ls].minn);
}

void printtree(int k, int l, int r){
    cout&amp;lt;&amp;lt;&quot;---&quot;&amp;lt;&amp;lt;endl;
    cout&amp;lt;&amp;lt;k&amp;lt;&amp;lt;&apos;,&apos;&amp;lt;&amp;lt;l&amp;lt;&amp;lt;&apos;,&apos;&amp;lt;&amp;lt;r&amp;lt;&amp;lt;endl;
    cout&amp;lt;&amp;lt;treee[k].minn&amp;lt;&amp;lt;&apos;,&apos;&amp;lt;&amp;lt;treee[k].sumr&amp;lt;&amp;lt;&apos;,&apos;&amp;lt;&amp;lt;treee[k].summ&amp;lt;&amp;lt;endl;
    cout&amp;lt;&amp;lt;&quot;---&quot;&amp;lt;&amp;lt;endl;
    if(l!=r){
        printtree(ls, l, mid);
        printtree(rs, mid+1, r);
    }
}

void minuss(int k, int l, int r, int pos){
    if(pos &amp;lt; l || pos &amp;gt; r){
        return;
    }
    if(l==r){
        treee[k].minn--;
        treee[k].sumr--;
        return;
    }
    minuss(treee[k].lson, l, mid, pos);
    minuss(treee[k].rson, mid+1, r, pos);
    
    treee[k].minn = min(treee[ls].minn, treee[rs].minn);
    treee[k].summ = treee[ls].summ + treee[rs].summ;
    treee[k].sumr = treee[ls].sumr + treee[rs].sumr;
    treee[k].summ += bias(rs, mid+1, r, treee[ls].minn);
}

struct query_node{
    int minn, summ;
};

query_node querysum(int k, int l, int r, int ll, int rr, int bb){
    if(l &amp;gt; rr || r &amp;lt; ll){
        query_node res;
        res.minn = bb;
        res.summ = 0;
        return res;
    }
    if(l &amp;gt;= ll &amp;amp;&amp;amp; r &amp;lt;= rr){
        query_node res;
        res.minn = min(bb, treee[k].minn);
        res.summ = treee[k].summ;
        if(bb != inf){
            res.summ += bias(k, l, r, bb);
        }
        return res;
    }
    query_node lres = querysum(ls, l, mid, ll, rr, bb);
    query_node rres = querysum(rs, mid+1, r, ll, rr, min(bb, lres.minn));
    query_node res;
    res.minn = min(bb, rres.minn);
    res.minn = min(res.minn, lres.minn);
    res.summ = lres.summ + rres.summ;
    return res;
}

signed main(){
    cin&amp;gt;&amp;gt;n&amp;gt;&amp;gt;q;
    inittree(1, n);
    for(int i=1;i&amp;lt;=n;i++){
        cin&amp;gt;&amp;gt;a[i];
    }

    b[1] = 0;
    for(int i=2;i&amp;lt;=n;i++){
        b[i] = b[i-1];
        if(a[i] &amp;gt; a[i-1]){
            int ovo = 0;
            while(a[i-1] * (1&amp;lt;&amp;lt;ovo) &amp;lt;= a[i]){ ovo++;}
            ovo--;
            b[i] -= ovo;
        }
        else if(a[i] &amp;lt; a[i-1]){
            int ovo = 0;
            while(a[i] * (1&amp;lt;&amp;lt;ovo) &amp;lt; a[i-1]) ovo++;
            b[i] += ovo;
        }
    }

    buildtree(1, 1, n);
    while(q--){
        int opt;
        cin&amp;gt;&amp;gt;opt;
        if(opt == 1){
            int pos;
            cin&amp;gt;&amp;gt;pos;
            minuss(1,1,n,pos);
        }else{
            int l, r;
            cin&amp;gt;&amp;gt;l&amp;gt;&amp;gt;r;
            query_node result = querysum(1,1,n,l,r,inf);
            cout&amp;lt;&amp;lt;result.summ&amp;lt;&amp;lt;endl;
        }
    }
    
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;从夯到拉&lt;/h1&gt;
&lt;p&gt;最近从夯到拉的排名很火，于是：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;rank_problem.png&quot; alt=&quot;题目排名&quot; /&gt;&lt;/p&gt;
&lt;p&gt;主要依据是题目的思维跳跃度/难易度，野榜，仅代表个人的偏好，不喜轻喷（&lt;/p&gt;
&lt;h1&gt;题外话&lt;/h1&gt;
&lt;p&gt;2024的Coding Challenge活到了第二天的下午，这次第一名的大佬熬到第二天凌晨6点左右就完赛了，:spoiler[快进到2026年的1024比赛开赛当天就被AK]&lt;/p&gt;
&lt;p&gt;主播这次就比较摆了，磨蹭到结束前两个小时才写完&lt;/p&gt;
&lt;p&gt;每次打OI竞赛的时候都很感慨自己当初为什么不在体制内继续学信息学奥赛（哭）&lt;/p&gt;
&lt;p&gt;总之非常感谢出题组的付出，使这个活动延续下去，也提供了一个认识各位大佬的平台~&lt;/p&gt;
</content:encoded></item><item><title>IG Chemistry(0620) 复习笔记</title><link>https://blog.haoye.plus/posts/ig_chem/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/ig_chem/</guid><description>IGCSE化学复习笔记</description><pubDate>Mon, 15 Sep 2025 00:00:00 GMT</pubDate><content:encoded>&lt;blockquote&gt;
&lt;p&gt;本文根据savemyexams, 课上的笔记和网络上的信息整理而来&lt;/p&gt;
&lt;p&gt;虽说我尽量把我所学的所有IG化学知识都记录在此。但难免有疏漏，最好考前看一眼syllabus: &lt;a href=&quot;https://www.cambridgeinternational.org/programmes-and-qualifications/cambridge-upper-secondary/cambridge-igcse/subjects/&quot;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;标注为(!)的部分代表此部分笔记为课堂笔记整理而来，并没有对照savemyexams或者syllabus检查过全面性 &lt;s&gt;(差异有点大就以老师的为准了(逃))&lt;/s&gt;，需要读者自行验证&lt;/p&gt;
&lt;p&gt;本文原先使用Typora撰写，其中有些拓展语法(如高亮==, 上标^, 下标~) fuwari并不支持 &lt;s&gt;（而我也懒得改成LaTeX了）&lt;/s&gt; ，请见谅QAQ&lt;/p&gt;
&lt;p&gt;所以如果有任何错误/补充欢迎评论指正&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Table of Content:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#1-states-of-matter&quot;&gt;1. States of Matter&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#11-solids-liquids--gases&quot;&gt;1.1 Solids, Liquids &amp;amp; Gases&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#111-kinetic-theory&quot;&gt;1.1.1 Kinetic Theory(..)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#112-states-of-matter&quot;&gt;1.1.2 States of Matter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#113-pressure--temperature-in-gases&quot;&gt;1.1.3 Pressure &amp;amp; Temperature in Gases&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#114-diffusion&quot;&gt;1.1.4 Diffusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#2-atoms-elements--compounds&quot;&gt;2. Atoms, Elements &amp;amp; Compounds&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#21-atomic-structure--the-periodic-table&quot;&gt;2.1 Atomic Structure &amp;amp; the Periodic Table&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#211-elements-compounds--mixtures&quot;&gt;2.1.1 Elements, Compounds &amp;amp; Mixtures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#212-atomic-structure&quot;&gt;2.1.2 Atomic Structure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#213-electronic-configuration&quot;&gt;2.1.3 Electronic Configuration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#214-isotopes&quot;&gt;2.1.4 Isotopes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#22-ions--ionic-bonds&quot;&gt;2.2 Ions &amp;amp; Ionic Bonds&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#221-ions--ionic-bonds&quot;&gt;2.2.1 Ions &amp;amp; Ionic Bonds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#222-ionic-bonds--lattice-structure&quot;&gt;2.2.2 Ionic Bonds &amp;amp; Lattice Structure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#223-properties-of-ionic-compounds&quot;&gt;2.2.3 Properties of Ionic Compounds&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#23-simple-molecules--covalent-bonds&quot;&gt;2.3 Simple Molecules &amp;amp; Covalent Bonds&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#231-covalent-bonds&quot;&gt;2.3.1 Covalent Bonds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#232-molecules--compounds&quot;&gt;2.3.2 Molecules &amp;amp; Compounds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#233-properties-of-simple-molecular-compounds&quot;&gt;2.3.3 Properties of Simple Molecular Compounds&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#24-giant-structures&quot;&gt;2.4 Giant Structures&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#diamond--graphite%E7%9F%B3%E5%A2%A8&quot;&gt;Diamond &amp;amp; Graphite(石墨)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#242-siliconiv-oxide&quot;&gt;2.4.2 Silicon(IV) Oxide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#243-metallic-bonding&quot;&gt;2.4.3 Metallic Bonding&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#3-stoichiometry&quot;&gt;3. Stoichiometry&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#31-formulae--relative-masses&quot;&gt;3.1 Formulae &amp;amp; Relative Masses&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#311-formulae&quot;&gt;3.1.1 Formulae&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#312-empirical-formulae--formulae-of-ionic-compounds&quot;&gt;3.1.2 Empirical Formulae &amp;amp; Formulae of Ionic Compounds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#313-writing-equations&quot;&gt;3.1.3 Writing Equations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#314-ar--mr&quot;&gt;3.1.4 Ar &amp;amp; Mr&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#32-the-mole--the-avogadro-constant&quot;&gt;3.2 The Mole &amp;amp; the Avogadro Constant&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#321-the-mole&quot;&gt;3.2.1 The Mole&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#322-linking-moles-mass--mr&quot;&gt;3.2.2 Linking Moles, Mass &amp;amp; Mr&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#323-reacting-masses&quot;&gt;3.2.3 Reacting Masses&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#324-calculating-concentration&quot;&gt;3.2.4 Calculating Concentration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#325-titration-calculations&quot;&gt;3.2.5 Titration Calculations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#326-empirical--molecular-formula&quot;&gt;3.2.6 Empirical &amp;amp; Molecular Formula&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#327-percentage-yield--purity&quot;&gt;3.2.7 Percentage Yield &amp;amp; Purity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#4-electrochemistry&quot;&gt;4. Electrochemistry&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#41-electrolysis&quot;&gt;4.1 Electrolysis&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#411-electrolysis-principles&quot;&gt;4.1.1 Electrolysis Principles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#412-electrolysis-of-molten-compounds&quot;&gt;4.1.2 Electrolysis of Molten Compounds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#413-electrolysis-of-aqueous-sodium-chloride--dilute-sulfuric-acid&quot;&gt;4.1.3 Electrolysis of Aqueous Sodium Chloride &amp;amp; Dilute Sulfuric Acid&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#414-electrolysis-of-aqueous-solutions&quot;&gt;4.1.4 Electrolysis of Aqueous Solutions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#415-ionic-half-equations&quot;&gt;4.1.5 Ionic Half Equations&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#42-applications-of-electrolysis&quot;&gt;4.2 Applications of Electrolysis&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#421-electroplating&quot;&gt;4.2.1 Electroplating&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#422-hydrogen-fuel-cells&quot;&gt;4.2.2 Hydrogen Fuel Cells&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#5-chemical-energetics&quot;&gt;5. Chemical Energetics&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#51-exothermic--endothermic-reactions&quot;&gt;5.1 Exothermic &amp;amp; Endothermic Reactions&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#511-endothermic--exothermic-reactions&quot;&gt;5.1.1 Endothermic &amp;amp; Exothermic Reactions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#512-enthalpy-change--activation-energy&quot;&gt;5.1.2 Enthalpy Change &amp;amp; Activation Energy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#513-bond-breaking--bond-forming&quot;&gt;5.1.3 Bond Breaking &amp;amp; Bond Forming&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#6-chemical-reactions&quot;&gt;6. Chemical Reactions(!)&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#61-chemical-change--rate-of-reaction&quot;&gt;6.1 Chemical Change &amp;amp; Rate of Reaction&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#611-physical--chemical-changes&quot;&gt;6.1.1 Physical &amp;amp; Chemical Changes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#612-rates-of-reaction-factors&quot;&gt;6.1.2 Rates of Reaction Factors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#613-collision-theory&quot;&gt;6.1.3 Collision Theory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#614-explaining-rates-using-collision-theory&quot;&gt;6.1.4 Explaining Rates Using Collision Theory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#615-investigating-the-rate-of-a-reaction&quot;&gt;6.1.5 Investigating The Rate of a Reaction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#616-interpreting-data&quot;&gt;6.1.6 Interpreting Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#62-reversible-reactions--equilibrium&quot;&gt;6.2 Reversible Reactions &amp;amp; Equilibrium&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#621-reversible-reactions&quot;&gt;6.2.1 Reversible Reactions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#622-equilibrium&quot;&gt;6.2.2 Equilibrium&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#623-the-haber-process&quot;&gt;6.2.3 The Haber Process&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#624-the-contact-process&quot;&gt;6.2.4 The Contact Process&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#63-redox&quot;&gt;6.3 Redox(!)&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#631-oxidation--reduction&quot;&gt;6.3.1 Oxidation &amp;amp; Reduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#632-redox--electron-transfer&quot;&gt;6.3.2 Redox &amp;amp; Electron Transfer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#7-acids-bases--salts&quot;&gt;7. Acids, Bases &amp;amp; Salts&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#71-the-characteristic-properties-of-acids--bases&quot;&gt;7.1 The Characteristic Properties of Acids &amp;amp; Bases&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#711-properties-of-acids--bases&quot;&gt;7.1.1 Properties of Acids &amp;amp; Bases&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#712-the-ions-in-acids--alkalis&quot;&gt;7.1.2 The Ions in Acids &amp;amp; Alkalis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#713-proton-transfer-strong--weak-acids&quot;&gt;7.1.3 Proton Transfer, Strong &amp;amp; Weak Acids&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#714-classifying-oxides&quot;&gt;7.1.4 Classifying Oxides&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#72-preparation-of-salts&quot;&gt;7.2 Preparation of Salts&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#721-preparing-soluble-salts&quot;&gt;7.2.1 Preparing Soluble Salts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#722-preparing-insoluble-salts&quot;&gt;7.2.2 Preparing Insoluble Salts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#723-solubility-rules&quot;&gt;7.2.3 Solubility Rules&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#724-hydrated--anhydrous-salts&quot;&gt;7.2.4 Hydrated &amp;amp; Anhydrous Salts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#8-the-periodic-table&quot;&gt;8. The Periodic Table&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#81-the-periodic-table--trends&quot;&gt;8.1 The Periodic Table &amp;amp; Trends&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#811-the-periodic-table&quot;&gt;8.1.1 The Periodic Table&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#812-periodic-trends&quot;&gt;8.1.2 Periodic Trends&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#82-group-properties--trends&quot;&gt;8.2 Group Properties &amp;amp; Trends&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#821-group-i-properties&quot;&gt;8.2.1 Group I Properties&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#822-group-vii-properties&quot;&gt;8.2.2 Group VII Properties&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#823-group-vii-displacement-reactions&quot;&gt;8.2.3 Group VII Displacement Reactions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#824-transition-elements&quot;&gt;8.2.4 Transition Elements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#825-noble-gases&quot;&gt;8.2.5 Noble Gases&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#9-metals&quot;&gt;9. Metals&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#91-properties-uses--alloys-of-metals&quot;&gt;9.1 Properties, Uses &amp;amp; Alloys of Metals&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#911-properties-of-metals&quot;&gt;9.1.1 Properties of Metals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#912-uses-of-metalsal-cu&quot;&gt;9.1.2 Uses of Metals(Al, Cu)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#913-alloys%E5%90%88%E9%87%91&quot;&gt;9.1.3 Alloys(合金)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#92-reactivity-series--corrosion-of-metals&quot;&gt;9.2 Reactivity Series &amp;amp; Corrosion of Metals&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#921-reactivity-series&quot;&gt;9.2.1 Reactivity Series&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#922-explaining-reactivity&quot;&gt;9.2.2 Explaining Reactivity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#923-rusting-of-iron&quot;&gt;9.2.3 Rusting of Iron&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#924-galvanising--sacrificial%E7%89%BA%E7%89%B2-protection&quot;&gt;9.2.4 Galvanising &amp;amp; Sacrificial(牺牲) Protection&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#93-extraction-of-metals&quot;&gt;9.3 Extraction of Metals&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#931-extraction-of-metals&quot;&gt;9.3.1 Extraction of Metals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#932-extraction-of-iron-from-hematite%E8%B5%A4%E9%93%81%E7%9F%BF&quot;&gt;9.3.2 Extraction of Iron from Hematite(赤铁矿)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#933-extraction-of-aluminium-from-bauxite&quot;&gt;9.3.3 Extraction of Aluminium from Bauxite(!)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#10-chemistry-of-the-environment&quot;&gt;10. Chemistry of the Environment&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#101-water--water-pollution&quot;&gt;10.1 Water &amp;amp; Water Pollution&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#1011-water-chemical-tests&quot;&gt;10.1.1 Water: Chemical Tests&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1012-substances-in-water-from-natural-sources&quot;&gt;10.1.2 Substances in Water from Natural Sources&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1013-water-treatment&quot;&gt;10.1.3 Water Treatment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1014-fertilisers&quot;&gt;10.1.4 Fertilisers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#102-air-quality--climate&quot;&gt;10.2 Air Quality &amp;amp; Climate&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#1021-air&quot;&gt;10.2.1 Air&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1022-effects-of-greenhouse-gases&quot;&gt;10.2.2 Effects of Greenhouse Gases&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1023-reducing-the-effects-of-environmental-issues&quot;&gt;10.2.3 Reducing the Effects of Environmental Issues&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1024-photosynthesis&quot;&gt;10.2.4 Photosynthesis&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#11-organic-chemistry&quot;&gt;11. Organic Chemistry&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#111-formulae-functional-groups--terminology&quot;&gt;11.1 Formulae, Functional Groups &amp;amp; Terminology&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#1111-organic-formulae&quot;&gt;11.1.1 Organic Formulae&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1112-homologous-series&quot;&gt;11.1.2 Homologous Series&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1113-saturated--unsaturated-compounds&quot;&gt;11.1.3 Saturated &amp;amp; Unsaturated Compounds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1114-naming-organic-compounds&quot;&gt;11.1.4 Naming Organic Compounds(!)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#112-organic-families&quot;&gt;11.2 Organic Families(!)&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#1121-fossil-fuels&quot;&gt;11.2.1 Fossil Fuels&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1122-alkanes%E7%83%B7%E7%83%83&quot;&gt;11.2.2 Alkanes(烷烃)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1123-alkenes&quot;&gt;11.2.3 Alkenes(!!)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1124-addition-reactions&quot;&gt;11.2.4 Addition Reactions(!!)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1125-alcohols&quot;&gt;11.2.5 Alcohols&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1126-carboxylic-acids&quot;&gt;11.2.6 Carboxylic Acids&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1127-ethanoic-acid--esterification-reactions&quot;&gt;11.2.7 Ethanoic Acid &amp;amp; Esterification Reactions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#113-polymers&quot;&gt;11.3 Polymers(!)&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#1131-polymers&quot;&gt;11.3.1 Polymers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1132-addition--condensation-polymers&quot;&gt;11.3.2 Addition &amp;amp; Condensation Polymers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1133-plastics--their-disposal&quot;&gt;11.3.3 Plastics &amp;amp; their Disposal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1134-proteins&quot;&gt;11.3.4 Proteins&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#12-experimental-techniques--chemical-analysis&quot;&gt;12. Experimental Techniques &amp;amp; Chemical Analysis&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#121-experimental-techniques&quot;&gt;12.1 Experimental Techniques&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#1211-apparatus-for-measurements&quot;&gt;12.1.1 Apparatus for Measurements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1212-solutions&quot;&gt;12.1.2 Solutions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1213-acid-base-titrations&quot;&gt;12.1.3 Acid-Base Titrations&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#122-separation--purification&quot;&gt;12.2 Separation &amp;amp; Purification&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#1221-paper-chromatography%E8%89%B2%E8%B0%B1%E6%B3%95&quot;&gt;12.2.1 Paper Chromatography(色谱法)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1222-locating-agents--rf--values&quot;&gt;12.2.2 Locating Agents &amp;amp; Rf  Values&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1223-separation--purification-techniques&quot;&gt;12.2.3 Separation &amp;amp; Purification Techniques&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#123-identification-of-ions--gases&quot;&gt;12.3 Identification of Ions &amp;amp; Gases&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#1231-identification-of-anions&quot;&gt;12.3.1 Identification of Anions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1232-identification-of-cations&quot;&gt;12.3.2 Identification of Cations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1233-identification-of-gases&quot;&gt;12.3.3 Identification of Gases&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;1. States of Matter&lt;/h1&gt;
&lt;h2&gt;1.1 Solids, Liquids &amp;amp; Gases&lt;/h2&gt;
&lt;h3&gt;1.1.1 Kinetic Theory(..)&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;solids&lt;/th&gt;
&lt;th&gt;liquids&lt;/th&gt;
&lt;th&gt;gases&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Volume&lt;/td&gt;
&lt;td&gt;fixed&lt;/td&gt;
&lt;td&gt;fixed&lt;/td&gt;
&lt;td&gt;not fixed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;fixed shape&lt;/td&gt;
&lt;td&gt;adopt the shape of the container&lt;/td&gt;
&lt;td&gt;adopt the shape of the container&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;high density&lt;/td&gt;
&lt;td&gt;middle&lt;/td&gt;
&lt;td&gt;low density&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;regular pattern&lt;/td&gt;
&lt;td&gt;randomly arranged&lt;/td&gt;
&lt;td&gt;randomly arranged&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;vibrate around a fixed position&lt;/td&gt;
&lt;td&gt;move around each other&lt;/td&gt;
&lt;td&gt;move quickly and randomly in all directions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;low energy&lt;/td&gt;
&lt;td&gt;greater energy&lt;/td&gt;
&lt;td&gt;highest energy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;1.1.2 States of Matter&lt;/h3&gt;
&lt;p&gt;two points: &lt;strong&gt;melting point&lt;/strong&gt; and &lt;strong&gt;boiling point&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=3840/https://cdn.savemyexams.com/uploads/2022/07/1-1-2-changing-state.png&quot; alt=&quot;1-1-2-changing-state&quot; /&gt;&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;boiling&lt;/th&gt;
&lt;th&gt;evaporating&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;boiling point&lt;/td&gt;
&lt;td&gt;a range of temp&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;bubbles below the surface&lt;/td&gt;
&lt;td&gt;surface&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;range of temp: Condensation, evaporating&lt;/p&gt;
&lt;p&gt;sublimation: only a few solids(CO2,I2)&lt;/p&gt;
&lt;p&gt;reversible arrow: ⇌&lt;/p&gt;
&lt;h3&gt;1.1.3 Pressure &amp;amp; Temperature in Gases&lt;/h3&gt;
&lt;p&gt;Ideal Gas Law:
$$
pV=nRT
$$&lt;/p&gt;
&lt;h3&gt;1.1.4 Diffusion&lt;/h3&gt;
&lt;p&gt;==Diffusion==: Particles move down the concentration gradient (?)&lt;/p&gt;
&lt;p&gt;温度越高，diffusion越快&lt;/p&gt;
&lt;p&gt;random motion of particles&lt;/p&gt;
&lt;p&gt;high concentration -&amp;gt; low concentration&lt;/p&gt;
&lt;p&gt;the concentration is even as they spread out&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;relative molecular masses&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;NH3 + HCl -&amp;gt; NH4Cl&lt;/p&gt;
&lt;p&gt;HCl &amp;gt; NH3&lt;/p&gt;
&lt;p&gt;一些gas的论证：(vaporised 后）move randomly in the container, no forces between gaseous molecules(没有力支撑，液体就有支撑）, molecules can move apart（液体就不行）&lt;/p&gt;
&lt;h1&gt;2. Atoms, Elements &amp;amp; Compounds&lt;/h1&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Structure&lt;/th&gt;
&lt;th&gt;Bonding&lt;/th&gt;
&lt;th&gt;组成&lt;/th&gt;
&lt;th&gt;Graph(记得label ！)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Giant Ionic&lt;/td&gt;
&lt;td&gt;Ionic Bond&lt;/td&gt;
&lt;td&gt;Metal + Non-metal&lt;/td&gt;
&lt;td&gt;[  ]&amp;lt;sup&amp;gt;+&amp;lt;/sup&amp;gt; [  ]&amp;lt;sup&amp;gt;-&amp;lt;/sup&amp;gt; 或者正负离子交替&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Giant Metallic&lt;/td&gt;
&lt;td&gt;Metallic Bond&lt;/td&gt;
&lt;td&gt;Metal&lt;/td&gt;
&lt;td&gt;lattice的cations还有sea of delocalised e-&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Giant Covalent&lt;/td&gt;
&lt;td&gt;Covalent Bond&lt;/td&gt;
&lt;td&gt;Diamond, Graphite, SiO2&lt;/td&gt;
&lt;td&gt;一般不画&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Simple Molecular&lt;/td&gt;
&lt;td&gt;Covalent + Inter Molecular Forces&lt;/td&gt;
&lt;td&gt;Non-metal&lt;/td&gt;
&lt;td&gt;像文氏图,然后画电子(need = share)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Structure&lt;/th&gt;
&lt;th&gt;Electrical Conductivity&lt;/th&gt;
&lt;th&gt;Reason&lt;/th&gt;
&lt;th&gt;m.p. / b.p.&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Giant Ionic&lt;/td&gt;
&lt;td&gt;l / aq (molten / aqueous state)&lt;/td&gt;
&lt;td&gt;Mobile Ions&lt;/td&gt;
&lt;td&gt;High (Strong ionic bond between oppositely charged ions)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Giant Metallic&lt;/td&gt;
&lt;td&gt;s / l&lt;/td&gt;
&lt;td&gt;Delocalised e-&lt;/td&gt;
&lt;td&gt;High (Strong metallic bond between cations &amp;amp; delocalised e-)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Giant Covalent&lt;/td&gt;
&lt;td&gt;only graphite&lt;/td&gt;
&lt;td&gt;Delocalised e-&lt;/td&gt;
&lt;td&gt;High (Strong covalent between atoms)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Simple Molecular&lt;/td&gt;
&lt;td&gt;x&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Low (Weak IMF between molecules)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;2.1 Atomic Structure &amp;amp; the Periodic Table&lt;/h2&gt;
&lt;h3&gt;2.1.1 Elements, Compounds &amp;amp; Mixtures&lt;/h3&gt;
&lt;p&gt;Element: 元素&lt;/p&gt;
&lt;p&gt;Compound: 化合物&lt;/p&gt;
&lt;p&gt;Mixture: 混合物&lt;/p&gt;
&lt;p&gt;可以继续分为homogeneous mixture（质地统一） / heterogeneous mixture（不统一）&lt;/p&gt;
&lt;h3&gt;2.1.2 Atomic Structure&lt;/h3&gt;
&lt;p&gt;Subatomic particles: protons, neutrons, electrons&lt;/p&gt;
&lt;p&gt;nucleus: 原子核&lt;/p&gt;
&lt;p&gt;relative atomic mass: 相对原子质量&lt;/p&gt;
&lt;p&gt;Atomic number(Z): protons&lt;/p&gt;
&lt;p&gt;Nucleon Number / mass number (A): protons + neutrons&lt;/p&gt;
&lt;p&gt;Atomic notation: A上Z下&lt;/p&gt;
&lt;h3&gt;2.1.3 Electronic Configuration&lt;/h3&gt;
&lt;p&gt;表示原子结构两种方式：electron shell diagrams, electronic configuration (electronic structure)&lt;/p&gt;
&lt;p&gt;离原子核越远，电子层能量越高&lt;/p&gt;
&lt;p&gt;the outermost shell = the valence shell最外层&lt;/p&gt;
&lt;p&gt;period: number of notations&lt;/p&gt;
&lt;p&gt;group: last notation&lt;/p&gt;
&lt;p&gt;最外层电子：valency electrons&lt;/p&gt;
&lt;h3&gt;2.1.4 Isotopes&lt;/h3&gt;
&lt;p&gt;Isotopes: different atoms of the same element (that contain the same number of protons but a different number of neutrons)&lt;/p&gt;
&lt;p&gt;表示法：C-14(mass number)&lt;/p&gt;
&lt;p&gt;化学性质相似：相同的最外层电子&lt;/p&gt;
&lt;p&gt;物理性质差异：不同的原子质量&lt;/p&gt;
&lt;h2&gt;2.2 Ions &amp;amp; Ionic Bonds&lt;/h2&gt;
&lt;h3&gt;2.2.1 Ions &amp;amp; Ionic Bonds&lt;/h3&gt;
&lt;p&gt;Ion: An electrically charged atom or group of atoms formed by the loss or gain of electrons&lt;/p&gt;
&lt;p&gt;负离子：anion&lt;/p&gt;
&lt;p&gt;正离子：cation&lt;/p&gt;
&lt;p&gt;ionic bond: strong electrostatic forces of attraction between opposite charges&lt;/p&gt;
&lt;p&gt;dot-and-cross diagram: 元素外打括号，右上角写电荷。（只用画最外层电子）记得配平（前面写系数）&lt;/p&gt;
&lt;h3&gt;2.2.2 Ionic Bonds &amp;amp; Lattice Structure&lt;/h3&gt;
&lt;p&gt;lattice structure: ordered, repeating, regular arrangement of alternating anions and cations.&lt;/p&gt;
&lt;h3&gt;2.2.3 Properties of Ionic Compounds&lt;/h3&gt;
&lt;p&gt;solid at r.t.&lt;/p&gt;
&lt;p&gt;high m.p. and b.p. (strong electrostatic forces)&lt;/p&gt;
&lt;p&gt;good conductors of electricity in the molten state or in solution&lt;/p&gt;
&lt;p&gt;poor conductors in the solid state&lt;/p&gt;
&lt;h2&gt;2.3 Simple Molecules &amp;amp; Covalent Bonds&lt;/h2&gt;
&lt;h3&gt;2.3.1 Covalent Bonds&lt;/h3&gt;
&lt;p&gt;Covalent bond: pairs of electrons are shared between atoms(只有non-metal elements)&lt;/p&gt;
&lt;p&gt;Molecules: two or more atoms are covalently bonded together&lt;/p&gt;
&lt;p&gt;画dot-and-cross diagram: 两个圆相交部分画电子&lt;/p&gt;
&lt;p&gt;single covalent bond(single bond)只share一对电子&lt;/p&gt;
&lt;h3&gt;2.3.2 Molecules &amp;amp; Compounds&lt;/h3&gt;
&lt;p&gt;double bond / triple bound&lt;/p&gt;
&lt;h3&gt;2.3.3 Properties of Simple Molecular Compounds&lt;/h3&gt;
&lt;p&gt;Simple molecular compound: just a few atoms covalently bonded together&lt;/p&gt;
&lt;p&gt;low m.p. and b.p. (如果分子更大m.p.和b.p.也更大) (因为week intermolecular forces弱分子间作用力)&lt;/p&gt;
&lt;p&gt;poor electrical conductivity(no free ions or electrons)(可作为insulator)&lt;/p&gt;
&lt;h2&gt;2.4 Giant Structures&lt;/h2&gt;
&lt;h3&gt;Diamond &amp;amp; Graphite(石墨)&lt;/h3&gt;
&lt;p&gt;Allotropes(同素异形体): Different atomic or molecular arrangements of the same element in the same physical state&lt;/p&gt;
&lt;p&gt;Diamond: 接四个 form a tetrahedron(四面体)&lt;/p&gt;
&lt;p&gt;no intermolecular forces&lt;/p&gt;
&lt;p&gt;Graphite: 接三个 form layers of hexagons&lt;/p&gt;
&lt;p&gt;layer之间：weak intermolecular forces&lt;/p&gt;
&lt;p&gt;unpaired electron becomes delocalised&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Properties &amp;amp; Uses&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Diamond:&lt;/p&gt;
&lt;p&gt;don&apos;t conduct electricity&lt;/p&gt;
&lt;p&gt;high m.p.&lt;/p&gt;
&lt;p&gt;extremely hard and dense&lt;/p&gt;
&lt;p&gt;uses: jewellery, cutting tools&lt;/p&gt;
&lt;p&gt;Graphite: can conduct electricity, slippery and smooth, high m.p.&lt;/p&gt;
&lt;p&gt;pencil&lt;/p&gt;
&lt;p&gt;industrial lubricant(润滑剂)&lt;/p&gt;
&lt;p&gt;non-reactive electrods for electrolysis(conduct electricity, high m.p., inert(stable), cheap)&lt;/p&gt;
&lt;h3&gt;2.4.2 Silicon(IV) Oxide&lt;/h3&gt;
&lt;p&gt;Quartz: 石英&lt;/p&gt;
&lt;p&gt;结构：钻石的结构。碳变为硅，键上面放一个氧&lt;/p&gt;
&lt;p&gt;性质：类似于钻石，更便宜&lt;/p&gt;
&lt;p&gt;用途：sandpaper,&lt;/p&gt;
&lt;h3&gt;2.4.3 Metallic Bonding&lt;/h3&gt;
&lt;p&gt;metallic lattice&lt;/p&gt;
&lt;p&gt;electrons delocalised&lt;/p&gt;
&lt;p&gt;sea of electrons&lt;/p&gt;
&lt;p&gt;Properties:&lt;/p&gt;
&lt;p&gt;high m.p. and b.p.&lt;/p&gt;
&lt;p&gt;conduct electricity&lt;/p&gt;
&lt;p&gt;malleable(可塑性)&lt;/p&gt;
&lt;p&gt;Ductile(可延展性)&lt;/p&gt;
&lt;p&gt;(layers of positive ions can slide over one another and take up different positions)&lt;/p&gt;
&lt;p&gt;wire&lt;/p&gt;
&lt;h1&gt;3. Stoichiometry&lt;/h1&gt;
&lt;p&gt;(化学计量法)&lt;/p&gt;
&lt;p&gt;Solid: $n=\frac{m}{Mr}$ (m单位g , Mr单位g mol&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;/p&gt;
&lt;p&gt;Liquid: $n = c \times V$ (c单位mol dm&amp;lt;sup&amp;gt;-3&amp;lt;/sup&amp;gt;   ,  V单位dm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;)&lt;/p&gt;
&lt;p&gt;Gas: $n=\frac{V}{24}$(V单位dm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, 24单位dm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; mol&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;/p&gt;
&lt;h2&gt;3.1 Formulae &amp;amp; Relative Masses&lt;/h2&gt;
&lt;h3&gt;3.1.1 Formulae&lt;/h3&gt;
&lt;p&gt;diatomic molecules: 双原子分子&lt;/p&gt;
&lt;h3&gt;3.1.2 Empirical Formulae &amp;amp; Formulae of Ionic Compounds&lt;/h3&gt;
&lt;p&gt;Empirical formula: 实验式&lt;/p&gt;
&lt;p&gt;polyatomic: 多原子的&lt;/p&gt;
&lt;h3&gt;3.1.3 Writing Equations&lt;/h3&gt;
&lt;p&gt;reactants: 反应物&lt;/p&gt;
&lt;p&gt;products: 生成物&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Solid = (s)&lt;/li&gt;
&lt;li&gt;Liquid = (l)&lt;/li&gt;
&lt;li&gt;Gas = (g)&lt;/li&gt;
&lt;li&gt;Aqueous = (aq)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Precipitates: 沉淀&lt;/p&gt;
&lt;h3&gt;3.1.4 Ar &amp;amp; Mr&lt;/h3&gt;
&lt;p&gt;Ar: relative atomic mass&lt;/p&gt;
&lt;p&gt;Mr: relative molecular mass&lt;/p&gt;
&lt;p&gt;(对于ionic compound是relative formula mass)&lt;/p&gt;
&lt;h2&gt;3.2 The Mole &amp;amp; the Avogadro Constant&lt;/h2&gt;
&lt;h3&gt;3.2.1 The Mole&lt;/h3&gt;
&lt;p&gt;The mole: the SI unit of amount of substance&lt;/p&gt;
&lt;p&gt;Avogadro Constant: 6.02e23&lt;/p&gt;
&lt;p&gt;molar mass: 一摩尔的物质的质量(gram)在数值上等于相对质量&lt;/p&gt;
&lt;p&gt;Avogadro&apos;s Law: same temperature and pressure, 相同数量气体占的空气相等&lt;/p&gt;
&lt;p&gt;常温常压1mol气体占24dm3 / 24000cm3空间(molar gas volume at RTP)&lt;/p&gt;
&lt;h3&gt;3.2.2 Linking Moles, Mass &amp;amp; Mr&lt;/h3&gt;
&lt;p&gt;n = m / Mr&lt;/p&gt;
&lt;h3&gt;3.2.3 Reacting Masses&lt;/h3&gt;
&lt;p&gt;limiting reactant: the reactant that is used up first&lt;/p&gt;
&lt;p&gt;excess reactant: the one that is remaining&lt;/p&gt;
&lt;h3&gt;3.2.4 Calculating Concentration&lt;/h3&gt;
&lt;p&gt;Solute(溶质): a solid substance that dissolves into a liquid&lt;/p&gt;
&lt;p&gt;Solvent(溶剂): the liquid that a solute dissolves in&lt;/p&gt;
&lt;p&gt;concentration: the amount of solute there is in a specific volume of the solvent(g/dm3 &amp;amp; mol/dm3)&lt;/p&gt;
&lt;h3&gt;3.2.5 Titration Calculations&lt;/h3&gt;
&lt;h3&gt;3.2.6 Empirical &amp;amp; Molecular Formula&lt;/h3&gt;
&lt;p&gt;Hydrated salt: a crystallised salt that contains water molecules as part of its structure&lt;/p&gt;
&lt;h3&gt;3.2.7 Percentage Yield &amp;amp; Purity&lt;/h3&gt;
&lt;p&gt;Yield: the term used to describe the amount of product you get from a reaction&lt;/p&gt;
&lt;p&gt;percentage yield = actual yield / theoretical yield&lt;/p&gt;
&lt;p&gt;percentage composition:&lt;/p&gt;
&lt;p&gt;Percentage purity&lt;/p&gt;
&lt;h1&gt;4. Electrochemistry&lt;/h1&gt;
&lt;h2&gt;4.1 Electrolysis&lt;/h2&gt;
&lt;p&gt;==Electrolysis==: Break down ionic compounds in molten / aqueous state by electricity&lt;/p&gt;
&lt;h3&gt;4.1.1 Electrolysis Principles&lt;/h3&gt;
&lt;p&gt;molten / aqueous&lt;/p&gt;
&lt;p&gt;ionic compounds&lt;/p&gt;
&lt;p&gt;electrode: a rod of metal(platinum) or graphite through which an electric current flows into or out of an electrolyte (conductor, inert)&lt;/p&gt;
&lt;p&gt;electrolyte: the ionic compound in a molten or dissolved solution that conducts the electricity&lt;/p&gt;
&lt;p&gt;-&amp;gt; Molten Salt&lt;/p&gt;
&lt;p&gt;-&amp;gt; Conc / dilute solution&lt;/p&gt;
&lt;p&gt;-&amp;gt; Copper electrodes&lt;/p&gt;
&lt;p&gt;anode: the positive electrode of an electrolysis cell&lt;/p&gt;
&lt;p&gt;anion: negatively charged ion&lt;/p&gt;
&lt;p&gt;cathode: the negative electrode of an electrolysis cell&lt;/p&gt;
&lt;p&gt;cation: positively charged ion&lt;/p&gt;
&lt;p&gt;anode: non-metals (在没有conc的情況oh先氧化，否则halogen先)&lt;/p&gt;
&lt;p&gt;cathode: hydrogen / metal&lt;/p&gt;
&lt;p&gt;PANIC(Positive is Anode Negative Is Cathode)&lt;/p&gt;
&lt;p&gt;AN OX / RED CAT (Anode Oxidation / Reduction Cathode)&lt;/p&gt;
&lt;p&gt;Shiny: Nickel, chromium&lt;/p&gt;
&lt;h3&gt;4.1.2 Electrolysis of Molten Compounds&lt;/h3&gt;
&lt;p&gt;binary ionic compound: consisting of just two elements joined together by ionic bonding&lt;/p&gt;
&lt;h3&gt;4.1.3 Electrolysis of Aqueous Sodium Chloride &amp;amp; Dilute Sulfuric Acid&lt;/h3&gt;
&lt;p&gt;brine: concentrated solution of aqueous sodium chloride&lt;/p&gt;
&lt;p&gt;gas test for chlorine: if damp litmus paper is dipped into a sample of the gas, it will turn red and then bleach to a white colour&lt;/p&gt;
&lt;h3&gt;4.1.4 Electrolysis of Aqueous Solutions&lt;/h3&gt;
&lt;p&gt;ammeter: 电流表&lt;/p&gt;
&lt;p&gt;两个电极都是铜，液体是硫酸铜：硫酸铜浓度不变，电极质量变化&lt;/p&gt;
&lt;h3&gt;4.1.5 Ionic Half Equations&lt;/h3&gt;
&lt;p&gt;Oxidation: loss of electrons&lt;/p&gt;
&lt;p&gt;Reduction: gain of electrons&lt;/p&gt;
&lt;p&gt;4OH-  -&amp;gt;  O2 + 2H2O + 4e-&lt;/p&gt;
&lt;p&gt;OIL RIG(Oxidation Is Loss, Reduction Is Gain)&lt;/p&gt;
&lt;p&gt;RED CAT(Reduction at the Cathode)&lt;/p&gt;
&lt;p&gt;AN OX(Anode for Oxidation)&lt;/p&gt;
&lt;h2&gt;4.2 Applications of Electrolysis&lt;/h2&gt;
&lt;h3&gt;4.2.1 Electroplating&lt;/h3&gt;
&lt;p&gt;Electroplating: the surface of one metal is coated with a layer of a different metal&lt;/p&gt;
&lt;p&gt;cathode: object to be electroplated&lt;/p&gt;
&lt;p&gt;anode: made from the pure metal that will be plated onto the object&lt;/p&gt;
&lt;p&gt;Reason: make metals more resistant to corrosion or damage&lt;/p&gt;
&lt;h3&gt;4.2.2 Hydrogen Fuel Cells&lt;/h3&gt;
&lt;p&gt;fuel: a substance which releases energy when burned&lt;/p&gt;
&lt;p&gt;Advantages:&lt;/p&gt;
&lt;p&gt;Renewable, no pollution, release more energy per kg, no power is lost in transmission, quieter&lt;/p&gt;
&lt;p&gt;Disadvantages:&lt;/p&gt;
&lt;p&gt;expensive, hydrogen is more difficult and expensive to store compared to petrol(flammable and easily explodes when under pressure), affected by low temp&lt;/p&gt;
&lt;h1&gt;5. Chemical Energetics&lt;/h1&gt;
&lt;h2&gt;5.1 Exothermic &amp;amp; Endothermic Reactions&lt;/h2&gt;
&lt;h3&gt;5.1.1 Endothermic &amp;amp; Exothermic Reactions&lt;/h3&gt;
&lt;p&gt;system: the reacting chemicals&lt;/p&gt;
&lt;p&gt;surroundings: anything other than the reacting chemicals&lt;/p&gt;
&lt;p&gt;和acid反应，carbonate可以是exo或者endo，metal只能exo&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Exothermic Reaction&lt;/strong&gt;: 放热&lt;/p&gt;
&lt;p&gt;==Definition==: An exothermic reaction transfers thermal energy to the surroundings leading to an increase in the temperature of the surroundings.&lt;/p&gt;
&lt;p&gt;e.g.: Neutralization, oxidation, combustion(燃烧反应), dissolving anhydrous salts, reaction between acids and metal carbonates, dissolving crystalline salts(？)&lt;/p&gt;
&lt;p&gt;application: hand warmers, self-heating cans&lt;/p&gt;
&lt;p&gt;\Delta H &amp;lt; 0&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Endothermic Reaction&lt;/strong&gt;: 吸热&lt;/p&gt;
&lt;p&gt;==Definition==: An endothermic reaction takes in thermal energy from the surroundings leading to a decrease in the temperature of the surroundings.&lt;/p&gt;
&lt;p&gt;e.g.: Atomization(变成原子？), Electrolysis, thermal decomposition, the first stage of photosynthesis(光合作用),&lt;/p&gt;
&lt;p&gt;Application: cold packs&lt;/p&gt;
&lt;p&gt;\Delta H &amp;gt; 0&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reaction pathway diagram&lt;/strong&gt;(reaction profiles)&lt;/p&gt;
&lt;p&gt;peak: transition state / activated complex&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2022/05/exothermic--endothermic-reactions.png&quot; alt=&quot;exothermic--endothermic-reactions&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;5.1.2 Enthalpy Change &amp;amp; Activation Energy&lt;/h3&gt;
&lt;p&gt;原子或分子想要反应要撞在一起。影响因素有能量，方向，频率...&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Definitions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Enthalpy(H)(kJ/mol): an indication of the total energy of a substance and it cannot be measured directly.&lt;/p&gt;
&lt;p&gt;==Enthalpy change== of a reaction($\Delta H$): The transfer of thermal energy during a reaction.&lt;/p&gt;
&lt;p&gt;$\Delta H$ is negative for exothermic reactions and positive for endothermic reactions.
$$
\Delta H = \Sigma H(products) - \Sigma H(reactants)
$$
*&lt;strong&gt;Energetic stability of a system&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Exothermic reactions are more energetically favorable(likely to happen) than endothermic ones because a system with lower energy content is more stable.&lt;/p&gt;
&lt;p&gt;Lower energy state -&amp;gt; more stable&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Standard enthalpy changes&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Standard enthalpy changes: $\Delta H °$&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Standard condition(°-结合在一起)&lt;/strong&gt;: To make comparison of enthalpy changes a fair comparison, same conditions must be used.&lt;/p&gt;
&lt;p&gt;Pressure: 101kPa&lt;/p&gt;
&lt;p&gt;Temperature: 298K&lt;/p&gt;
&lt;p&gt;Concentration of solutions: 1.0 mol / dm3&lt;/p&gt;
&lt;p&gt;Normal physical state&lt;/p&gt;
&lt;p&gt;Allotropes: 选更energetically stable的 (选石墨不选钻石)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Activation Energy&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;==Definition==: The minimum energy that colliding particles must have to react&lt;/p&gt;
&lt;p&gt;E~A(forward)~：从reactants到顶峰的能量&lt;/p&gt;
&lt;p&gt;E~A(reverse)~：从products到顶峰的能量&lt;/p&gt;
&lt;h3&gt;5.1.3 Bond Breaking &amp;amp; Bond Forming&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Bond Energy&lt;/strong&gt;(Bond enthalpy): Energy required to break a mole of (covalent) bonds in the gaseous state. (always positive($\Delta H &amp;gt; 0$))&lt;/p&gt;
&lt;p&gt;有些bond energy是确定的有些取平均（被其他原子的存在所一项&lt;/p&gt;
&lt;p&gt;breaking bonds: needs energy (endothermic)&lt;/p&gt;
&lt;p&gt;forming bonds: releases energy (exothermic)&lt;/p&gt;
&lt;p&gt;Bond breaking:&lt;/p&gt;
&lt;p&gt;the energy needed to break bonds&lt;/p&gt;
&lt;p&gt;Energy change = Energy required to break bonds - Energy given out when bonds are made(左边减去右边)&lt;/p&gt;
&lt;h1&gt;6. Chemical Reactions(!)&lt;/h1&gt;
&lt;h2&gt;6.1 Chemical Change &amp;amp; Rate of Reaction&lt;/h2&gt;
&lt;h3&gt;6.1.1 Physical &amp;amp; Chemical Changes&lt;/h3&gt;
&lt;p&gt;Physical changes: Changes in which new chemical substances are not produced&lt;/p&gt;
&lt;p&gt;e.g. change in states, separation of mixtures ...&lt;/p&gt;
&lt;p&gt;Chemical changes: changes in which new chemical substances are produced&lt;/p&gt;
&lt;p&gt;e.g. Decomposition, electrolysis, respiration, photosynthesis, polymerisation, combustion, etc.&lt;/p&gt;
&lt;h3&gt;6.1.2 Rates of Reaction Factors&lt;/h3&gt;
&lt;p&gt;study of chemical reactions -&amp;gt; reaction kinetics&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Rate of reaction&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Rate = change in amount of reactants or product / time&lt;/p&gt;
&lt;p&gt;Unit: mol dm^-3^ s^-1^ / mol dm^-3^ min^-1^ / mol dm^-3^ h^-1^&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;change in amount&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;-&amp;gt; volume of gas&lt;/p&gt;
&lt;p&gt;-&amp;gt; concentration of reactants or products&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Measuring rate of reaction&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Acidity:&lt;/p&gt;
&lt;p&gt;Volume:&lt;/p&gt;
&lt;p&gt;Mass:&lt;/p&gt;
&lt;p&gt;Appearance:&lt;/p&gt;
&lt;p&gt;Electrical conductivity:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Calculation of the rate of reaction&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;gradient / tangent line&lt;/p&gt;
&lt;p&gt;rate of reaction = d[reactant或者product] / dt&lt;/p&gt;
&lt;p&gt;reactant的话要取负的gradient&lt;/p&gt;
&lt;h3&gt;6.1.3 Collision Theory&lt;/h3&gt;
&lt;p&gt;Heterogeneous reactions:  不同phase之间的物质的reaction&lt;/p&gt;
&lt;p&gt;Reaction:&lt;/p&gt;
&lt;p&gt;-&amp;gt; particles must collide&lt;/p&gt;
&lt;p&gt;-&amp;gt; in the correct orientation and with sufficient energy&lt;/p&gt;
&lt;p&gt;Activation Energy: The minimum energy required for a reaction to occur (E~A~)&lt;/p&gt;
&lt;p&gt;Ineffective Collision: takes place if the colliding particles do not have enough energy to react (low K.E.)&lt;/p&gt;
&lt;p&gt;Effective(successful) Collision: takes place if the colliding particles do have enough energy to react (high K.E.)&lt;/p&gt;
&lt;p&gt;sme上的定义(?): A successful collision is where the particles in the reactant(s) are rearranged to form the products&lt;/p&gt;
&lt;p&gt;Speeding up a reaction -&amp;gt; increase rate -&amp;gt; increase effective collision -&amp;gt; (breakpoint) increase collision frequency -&amp;gt; Concentration / Pressure / Surface Area / Temperature&lt;/p&gt;
&lt;p&gt;(breakpoint) increase # of particles with E &amp;gt; E~A~ -&amp;gt; Temperature / Catalyst&lt;/p&gt;
&lt;p&gt;Energy of molecules -&amp;gt; directly proportional to their absolute temperature&lt;/p&gt;
&lt;p&gt;distribution of energies between different molecules: Boltzmann distribution (not all of the particles have the same amount of k.e. )&lt;/p&gt;
&lt;p&gt;(一个横轴molecular energy 纵轴number of molecules的图。在竖线E~A~右边的部分可以参与反应)&lt;/p&gt;
&lt;p&gt;-&amp;gt; The distribution always goes through the origin&lt;/p&gt;
&lt;p&gt;-&amp;gt; The curve approaches the x-axis but does not touch it&lt;/p&gt;
&lt;p&gt;-&amp;gt; The peak represents the most probable energy.&lt;/p&gt;
&lt;p&gt;-&amp;gt; The area under the curve represents the total number of particles.&lt;/p&gt;
&lt;p&gt;-&amp;gt; The shaded portion represents the number of particles with energy higher than or equal to the activation energy (E&amp;gt;=E~A~)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Effect of Concentration and Pressure&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;frequency of collisions 正相关&lt;/p&gt;
&lt;p&gt;不改变Boltzmann distribution of energies&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Effect of Surface Area&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;和Frequency of Collisions 正相关&lt;/p&gt;
&lt;p&gt;不改变Boltzmann Distribution of Energies&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Effect of Temperature&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;-&amp;gt; 改变Temperature -&amp;gt; 改变particles的K.E. -&amp;gt; 改变速度快慢 -&amp;gt; 改变 Collision Frequency&lt;/p&gt;
&lt;p&gt;-&amp;gt; 增加或减少有E大于等于E~A~的particles&lt;/p&gt;
&lt;p&gt;-&amp;gt; 总结：改变frequency of effective collisions&lt;/p&gt;
&lt;p&gt;温度增加：most probable energy更高，但更少的粒子达到了这个要求&lt;/p&gt;
&lt;p&gt;反之亦然&lt;/p&gt;
&lt;p&gt;Rate翻倍只要Temp加十就好了（有点像dB+3&lt;/p&gt;
&lt;p&gt;temp可以影响reactants的初始enthalpy(在endo exo那个图里面上移下移)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Effect of Catalyst&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Catalyst: increases(?) the rate of reaction by providing an alternative reaction path way with lower E~A~&lt;/p&gt;
&lt;p&gt;How: more particles have E&amp;gt;=E~A~, so increase in frequency of effective collisions&lt;/p&gt;
&lt;p&gt;催化剂的化学性质反应前后不改变&lt;/p&gt;
&lt;p&gt;在Boltzmann图面就是E~A~往左移，在endo exo的图里就是peak向下移&lt;/p&gt;
&lt;h3&gt;6.1.4 Explaining Rates Using Collision Theory&lt;/h3&gt;
&lt;h3&gt;6.1.5 Investigating The Rate of a Reaction&lt;/h3&gt;
&lt;h3&gt;6.1.6 Interpreting Data&lt;/h3&gt;
&lt;h2&gt;6.2 Reversible Reactions &amp;amp; Equilibrium&lt;/h2&gt;
&lt;p&gt;==Equilibrium==: The rate of the forward reaction is equal to the rate of the reverse reaction + the concentrations of reactants and products are no longer changing&lt;/p&gt;
&lt;p&gt;reversible reaction: one which can proceed in both directions, as indicated by the &quot;你知道是啥&quot; sign&lt;/p&gt;
&lt;p&gt;re-form&lt;/p&gt;
&lt;p&gt;equilibrium mixture (in balance)&lt;/p&gt;
&lt;p&gt;Dynamic Equilibrium: Rates of forward and reverse reactions are equal in a closed system. (No net change in concentration of reactants and products. (constant concentration))&lt;/p&gt;
&lt;p&gt;Equilibrium position: the relative amount of products and reactions present in an equilibrium mixture (mixture of reactants and products)&lt;/p&gt;
&lt;p&gt;Le Chatelier&apos;s Principle: If a change is made to a system at dynamic equilibrium, the position of equilibrium moves to minimise this change.&lt;/p&gt;
&lt;p&gt;-&amp;gt; 增减一个反应物会反作用（syllabus上说的是改变concentration，也就是说加pure solid和pure liquid也不会改变平衡位置(bestchoice)。存疑）&lt;/p&gt;
&lt;p&gt;-&amp;gt; pressure: 会影响气体，看反应物和生成物的摩尔数。会倾向于操作的相反&lt;/p&gt;
&lt;p&gt;-&amp;gt; temperature: 看是exo还是endo。倾向于操作的相反&lt;/p&gt;
&lt;p&gt;-&amp;gt; catalyst: 不影响equilibrium, 加速到达equilibrium的速度&lt;/p&gt;
&lt;p&gt;shift equilibrium to the left / right&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Haber process - Ammonia Production: N~2~(g) + 3H~2~(g) &amp;lt;-&amp;gt; 2NH~3~(g); ΔHr = -92 kJmol^-1^&lt;/strong&gt;&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factors&lt;/th&gt;
&lt;th&gt;Equilibrium Aspects&lt;/th&gt;
&lt;th&gt;Industrial Aspects&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Temperature&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;450 C&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pressure&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;200 atm&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Concentration(NH3)&lt;/td&gt;
&lt;td&gt;Removal of NH3&lt;/td&gt;
&lt;td&gt;Liquify NH3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Catalyst&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Iron(Fe)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;N2: Fractional distillation of liquid air&lt;/p&gt;
&lt;p&gt;H2: CH4(methane) + H2O(g) -&amp;gt; 3H2 + CO&lt;/p&gt;
&lt;p&gt;450: Compensate temperature (太低：increase in yield, low rate of reaction(低KE，低frequency))&lt;/p&gt;
&lt;p&gt;200: Compensate Pressure (太高：increase in yield, increase in operating cost / expensive)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Contact process - sulfuric acid production&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;-&amp;gt; S + O2 -&amp;gt; SO2 (buring sulfur or roasting sulfide ores)&lt;/p&gt;
&lt;p&gt;-&amp;gt; 2SO~2~(g) + O~2~(g) &amp;lt;-&amp;gt; 2SO~3~(g) (竟然是reversible的，必须制裁！)&lt;/p&gt;
&lt;p&gt;-&amp;gt; SO3 + H2O -&amp;gt; H2SO4  (* SO3 + H2SO4 -&amp;gt; H2S2O7 ; H2S2O7 + H2O -&amp;gt; 2H2SO4)&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factors&lt;/th&gt;
&lt;th&gt;Equilibrium Aspects&lt;/th&gt;
&lt;th&gt;Industrial Aspects&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Temperature&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;450 C&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pressure&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;2 atm&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Concentration&lt;/td&gt;
&lt;td&gt;Removal of SO3&lt;/td&gt;
&lt;td&gt;Absorbed by conc. H2SO4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Catalyst&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Vanadium Oxide, V2O5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;为什么Temperature和Pressure的值都不太低/高呢？和haber process的原因一样。需要compensate&lt;/p&gt;
&lt;p&gt;Factors:&lt;/p&gt;
&lt;p&gt;-&amp;gt;&lt;/p&gt;
&lt;h3&gt;6.2.1 Reversible Reactions&lt;/h3&gt;
&lt;h3&gt;6.2.2 Equilibrium&lt;/h3&gt;
&lt;h3&gt;6.2.3 The Haber Process&lt;/h3&gt;
&lt;h3&gt;6.2.4 The Contact Process&lt;/h3&gt;
&lt;h2&gt;6.3 Redox(!)&lt;/h2&gt;
&lt;p&gt;==Disproportionation== : a redox reaction in which both oxidation and reduction occurs on the same atom(it is simultaneously oxidised and reduced)&lt;/p&gt;
&lt;p&gt;O不是-2的特例：F2O (+2), H2O2 (-1)&lt;/p&gt;
&lt;p&gt;H不是+1的特例：和某个金属结合(metal hydride) NaH&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Formula&lt;/th&gt;
&lt;th&gt;Common Name&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;NO~3~^-^&lt;/td&gt;
&lt;td&gt;Nitrate ion&lt;/td&gt;
&lt;td&gt;Nitrate ion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NO~2~^-^&lt;/td&gt;
&lt;td&gt;Nitrite ion&lt;/td&gt;
&lt;td&gt;Nitrate ion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NO~2~&lt;/td&gt;
&lt;td&gt;Nitrogen dioxide&lt;/td&gt;
&lt;td&gt;Nitrogen (IV)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SO~4~^2-^&lt;/td&gt;
&lt;td&gt;Sulfate ion&lt;/td&gt;
&lt;td&gt;Sulfate (VI)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SO~3~^2-^&lt;/td&gt;
&lt;td&gt;Sulfite ion&lt;/td&gt;
&lt;td&gt;Sulfate (IV)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SO~2~&lt;/td&gt;
&lt;td&gt;Sulfur dioxide&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SO~3~&lt;/td&gt;
&lt;td&gt;Sulfur trioxide&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;MnO4- : manganate(VII)&lt;/p&gt;
&lt;h3&gt;6.3.1 Oxidation &amp;amp; Reduction&lt;/h3&gt;
&lt;p&gt;Roman numeral: 用来indicate the oxidation number of an element in a compound&lt;/p&gt;
&lt;p&gt;定义表&lt;/p&gt;
&lt;p&gt;Redox reactions: involving simultaneous oxidation and reduction / involving gain and loss of electrons&lt;/p&gt;
&lt;p&gt;==Oxidation==: gain of oxygen / loss of electrons / an increase in oxidation number&lt;/p&gt;
&lt;p&gt;==Reduction==: loss of oxygen / gain of electrons / a decrease in oxidation number&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;identify redox reactions by changes in oxidation number ...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Oxidation number: a number assigned to an atom or ion in a compound, showing the number of electrons that an atom&lt;/p&gt;
&lt;h3&gt;6.3.2 Redox &amp;amp; Electron Transfer&lt;/h3&gt;
&lt;p&gt;==Oxidising agent==: A substance that oxidises another substance and is itself reduced&lt;/p&gt;
&lt;p&gt;Very powerful: Acidified Potassium Manganate(VII): KMnO~4~&lt;/p&gt;
&lt;p&gt;MnO4- + 8H+ + 5e-  -&amp;gt;  Mn2+ + 4H2O&lt;/p&gt;
&lt;p&gt;pink -&amp;gt; colourless(?)&lt;/p&gt;
&lt;p&gt;==Reducing agent==: A substance that reduces another substance and is itself oxidised&lt;/p&gt;
&lt;p&gt;Very powerful: Potassium Iodide:&lt;/p&gt;
&lt;p&gt;2I-  -&amp;gt; I2 + 2e-&lt;/p&gt;
&lt;p&gt;colourless -&amp;gt; brown(?)&lt;/p&gt;
&lt;p&gt;加starch变深蓝&lt;/p&gt;
&lt;h1&gt;7. Acids, Bases &amp;amp; Salts&lt;/h1&gt;
&lt;p&gt;ethanoic acid: 乙酸&lt;/p&gt;
&lt;p&gt;ethanoate: 乙酸根（比如Magnesium Ethanoate)&lt;/p&gt;
&lt;h2&gt;7.1 The Characteristic Properties of Acids &amp;amp; Bases&lt;/h2&gt;
&lt;p&gt;base是碱，alkali是可溶解于水的碱&lt;/p&gt;
&lt;h3&gt;7.1.1 Properties of Acids &amp;amp; Bases&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Acids&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;pH&amp;lt;7&lt;/p&gt;
&lt;p&gt;sour taste&lt;/p&gt;
&lt;p&gt;corrosive&lt;/p&gt;
&lt;p&gt;Reactivity series: K,Na,Ca,Mg,Al,(C),Zn,Fe,Sn(Tin),Pb,(H),Cu,Ag,Au,Pt&lt;/p&gt;
&lt;p&gt;Acid + Metal -&amp;gt; Salt + Hydrogen(置换)&lt;/p&gt;
&lt;p&gt;acid + base -&amp;gt; salt + H2O(neutralisation)&lt;/p&gt;
&lt;p&gt;acid + metal carbonate -&amp;gt; salt + CO2 + H2O&lt;/p&gt;
&lt;p&gt;indicators(酸碱指示剂)&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Indicator&lt;/th&gt;
&lt;th&gt;Colour in acid&lt;/th&gt;
&lt;th&gt;Colour in alkali&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Litmus(石蕊)&lt;/td&gt;
&lt;td&gt;red&lt;/td&gt;
&lt;td&gt;blue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Thymolphthalein&lt;/td&gt;
&lt;td&gt;colourless&lt;/td&gt;
&lt;td&gt;blue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Methyl orange(甲基橙)&lt;/td&gt;
&lt;td&gt;red&lt;/td&gt;
&lt;td&gt;yellow&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Synthetic indicators: titration(sharp change of colour)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bases &amp;amp; Alkalis&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;==base==: Proton acceptor(?)&lt;/p&gt;
&lt;p&gt;==alkali==: soluble base&lt;/p&gt;
&lt;p&gt;pH&amp;gt;7&lt;/p&gt;
&lt;p&gt;Bases are usually oxides or hydroxides of metals&lt;/p&gt;
&lt;p&gt;Ammonium salt + alkali -&amp;gt; salt + H2O + NH3&lt;/p&gt;
&lt;p&gt;(用于检测ammonium ion，followed by 氨气的检测(damp潮湿的 red litmus paper turns blue))&lt;/p&gt;
&lt;h3&gt;7.1.2 The Ions in Acids &amp;amp; Alkalis&lt;/h3&gt;
&lt;p&gt;pH scale: how acidic or alkaline a solution is&lt;/p&gt;
&lt;p&gt;acidity, neutrality, alkalinity&lt;/p&gt;
&lt;p&gt;logarithmic对数的&lt;/p&gt;
&lt;p&gt;pH(n) -&amp;gt; 氢离子浓度为10^(-n) mol/L&lt;/p&gt;
&lt;p&gt;universal indicator: 不同指示剂的混合物。&lt;/p&gt;
&lt;h3&gt;7.1.3 Proton Transfer, Strong &amp;amp; Weak Acids&lt;/h3&gt;
&lt;p&gt;H+: proton(氕)&lt;/p&gt;
&lt;p&gt;Acids: proton donors&lt;/p&gt;
&lt;p&gt;Bases: proton acceptors&lt;/p&gt;
&lt;p&gt;strong &amp;amp; weak acids: completely / partially dissociate(ionise)&lt;/p&gt;
&lt;h3&gt;7.1.4 Classifying Oxides&lt;/h3&gt;
&lt;p&gt;acidic oxide / basic oxide&lt;/p&gt;
&lt;p&gt;酸性氧化物和碱反应。反之亦然&lt;/p&gt;
&lt;p&gt;neutral oxide(CO,NO,N2O)&lt;/p&gt;
&lt;p&gt;Amphoteric oxide(ZnO, Al2O3)&lt;/p&gt;
&lt;h2&gt;7.2 Preparation of Salts&lt;/h2&gt;
&lt;h3&gt;7.2.1 Preparing Soluble Salts&lt;/h3&gt;
&lt;p&gt;sulphate硫酸盐，chloride氯化物&lt;/p&gt;
&lt;p&gt;filtrate: 过滤后的液体&lt;/p&gt;
&lt;p&gt;Insoluble base: Dissolving&lt;/p&gt;
&lt;p&gt;use spatula to add excess CuCO3 into a beaker of HCL until no further bubbling or no further dissolving&lt;/p&gt;
&lt;p&gt;filter off the excess solid(取filtrate)&lt;/p&gt;
&lt;p&gt;heat the salt solution to evaporate water&lt;/p&gt;
&lt;p&gt;cool the saturated solution to form crystal&lt;/p&gt;
&lt;p&gt;wash the crystal with distilled water&lt;/p&gt;
&lt;p&gt;dry the crystal with filter paper&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2022/07/7-2-1-preparation-of-soluble-salts-1.png&quot; alt=&quot;7-2-1-preparation-of-soluble-salts-1&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Soluble base: Titration&lt;/p&gt;
&lt;p&gt;记得看syllabus!!&lt;/p&gt;
&lt;p&gt;-&amp;gt; Add alkali + indicator to conical flask using a pipette&lt;/p&gt;
&lt;p&gt;-&amp;gt; Add acid to burette, noting the starting volume&lt;/p&gt;
&lt;p&gt;-&amp;gt; add acid to alkali slowly until indicator changes colour&lt;/p&gt;
&lt;p&gt;-&amp;gt; calculate&lt;/p&gt;
&lt;p&gt;Use volumetric pipette to transfer 25cm3 of HCl(aq) into a conical flask&lt;/p&gt;
&lt;p&gt;Add a few drops of methyl orange indicator&lt;/p&gt;
&lt;p&gt;fill a burette with NaOH(aq)&lt;/p&gt;
&lt;p&gt;add NaOH(aq) from the burette to the conical flask until the end point - Orange&lt;/p&gt;
&lt;p&gt;repeat the process without indicator, but using the same volume of acid and alkali as used in the titration&lt;/p&gt;
&lt;p&gt;heat the salt solution to evaporate water&lt;/p&gt;
&lt;p&gt;cool the saturated solution to form crystal&lt;/p&gt;
&lt;p&gt;wash the crystal with distilled water&lt;/p&gt;
&lt;p&gt;dry the crystal with filter paper&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2022/07/7-2-1-titration-and-forming-salt.png&quot; alt=&quot;7-2-1-titration-and-forming-salt&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;7.2.2 Preparing Insoluble Salts&lt;/h3&gt;
&lt;p&gt;precipitation reaction&lt;/p&gt;
&lt;p&gt;the reactants must be soluble&lt;/p&gt;
&lt;p&gt;mix AgNO3(aq) and NaCl(aq) solution in a beaker&lt;/p&gt;
&lt;p&gt;filter the solution to collect the insoluble salt&lt;/p&gt;
&lt;p&gt;wash the crystal with distilled water&lt;/p&gt;
&lt;p&gt;dry the crystal with filter paper&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2020/01/Preparing-Insoluble-Salts.png&quot; alt=&quot;Preparing-Insoluble-Salts, IGCSE &amp;amp; GCSE Chemistry revision notes&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;7.2.3 Solubility Rules&lt;/h3&gt;
&lt;p&gt;Soluble: K, Na, NH4&lt;/p&gt;
&lt;p&gt;Soluble: NO3(硝酸)(Nitrate)&lt;/p&gt;
&lt;p&gt;Cl(默认可溶): Ag,Pb     ,Hg&lt;/p&gt;
&lt;p&gt;SO4(默认可溶): Ba, Ca, Pb     , Ra, Sr&lt;/p&gt;
&lt;p&gt;CO3(默认不可溶): 除了钾钠氨&lt;/p&gt;
&lt;p&gt;OH(默认不可溶): 除了钾钠氨，Ca(partially), Ba&lt;/p&gt;
&lt;p&gt;默认不可溶: OH(CaOH partially soluble,Ba(OH)2), CO3&lt;/p&gt;
&lt;p&gt;heat transfer: particle to particle transfer&lt;/p&gt;
&lt;p&gt;描述粒子运动：先random&lt;/p&gt;
&lt;h3&gt;7.2.4 Hydrated &amp;amp; Anhydrous Salts&lt;/h3&gt;
&lt;p&gt;Hydrated salts: salts that contain water within their structure&lt;/p&gt;
&lt;p&gt;Anhydrous sats: contain no water in their structure&lt;/p&gt;
&lt;p&gt;dehydrated: 脱水&lt;/p&gt;
&lt;p&gt;Water of crystallisation: water molecules included in the structure of some salts during the crystallisation process&lt;/p&gt;
&lt;p&gt;Color change:&lt;/p&gt;
&lt;p&gt;第一主族和第二主族没什么颜色。要记得color change两个：copper sulfate 蓝色到白色；cobalt(II) chloride 粉色到蓝色&lt;/p&gt;
&lt;h1&gt;8. The Periodic Table&lt;/h1&gt;
&lt;h2&gt;8.1 The Periodic Table &amp;amp; Trends&lt;/h2&gt;
&lt;h3&gt;8.1.1 The Periodic Table&lt;/h3&gt;
&lt;p&gt;order: Increasing atomic number&lt;/p&gt;
&lt;p&gt;group: 族&lt;/p&gt;
&lt;p&gt;period: 周期(electron shells)&lt;/p&gt;
&lt;p&gt;group 0第八组&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Valency&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Valency(combining power): how many bonds an atom can make with another atom or how many electrons its atoms lose, gain or share, to form a compound(化合价)&lt;/p&gt;
&lt;h3&gt;8.1.2 Periodic Trends&lt;/h3&gt;
&lt;p&gt;The metallic character左下最强，右上最弱&lt;/p&gt;
&lt;p&gt;metalloids / semi-metals(准金属): shows some of the properties of metals and some of non-metals&lt;/p&gt;
&lt;p&gt;transition elements are denser than group I elements&lt;/p&gt;
&lt;h2&gt;8.2 Group Properties &amp;amp; Trends&lt;/h2&gt;
&lt;h3&gt;8.2.1 Group I Properties&lt;/h3&gt;
&lt;p&gt;(alkali metals)&lt;/p&gt;
&lt;p&gt;soft and easy to cut&lt;/p&gt;
&lt;p&gt;shiny silvery surfaces&lt;/p&gt;
&lt;p&gt;conduct heat and electricity&lt;/p&gt;
&lt;p&gt;low m.p. and low density (越往下m.p.越低)&lt;/p&gt;
&lt;h3&gt;8.2.2 Group VII Properties&lt;/h3&gt;
&lt;p&gt;(halogens)&lt;/p&gt;
&lt;p&gt;poisonous&lt;/p&gt;
&lt;p&gt;diatomic&lt;/p&gt;
&lt;p&gt;halide ions&lt;/p&gt;
&lt;p&gt;Cl2(Chlorine): pale yellow-green gas&lt;/p&gt;
&lt;p&gt;Br2(Bromine): red-brown liquid&lt;/p&gt;
&lt;p&gt;I2(iodine): grey-black solid&lt;/p&gt;
&lt;p&gt;the outer electrons are closer to the nucleus so there are stronger electrostatic forces of attraction&lt;/p&gt;
&lt;p&gt;越往下颜色越深&lt;/p&gt;
&lt;h3&gt;8.2.3 Group VII Displacement Reactions&lt;/h3&gt;
&lt;p&gt;halogen displacement reaction&lt;/p&gt;
&lt;p&gt;I2 vapour: purple&lt;/p&gt;
&lt;p&gt;I2 aqueous: brown&lt;/p&gt;
&lt;h3&gt;8.2.4 Transition Elements&lt;/h3&gt;
&lt;p&gt;hard and strong&lt;/p&gt;
&lt;p&gt;good conductors of heat and electricity&lt;/p&gt;
&lt;p&gt;high m.p.   highly dense&lt;/p&gt;
&lt;p&gt;form coloured compounds and often have more than one oxidation state(pigments颜料)&lt;/p&gt;
&lt;p&gt;catalysts催化剂&lt;/p&gt;
&lt;p&gt;limb and joint replacement&lt;/p&gt;
&lt;p&gt;dyes and paints, stained glass jewellery&lt;/p&gt;
&lt;h3&gt;8.2.5 Noble Gases&lt;/h3&gt;
&lt;p&gt;Group 0&lt;/p&gt;
&lt;p&gt;low m.p. and b.p.&lt;/p&gt;
&lt;p&gt;monoatomic, colourless gasses&lt;/p&gt;
&lt;p&gt;full outer shells&lt;/p&gt;
&lt;p&gt;extremely stable (unreactive and inert)&lt;/p&gt;
&lt;h1&gt;9. Metals&lt;/h1&gt;
&lt;h2&gt;9.1 Properties, Uses &amp;amp; Alloys of Metals&lt;/h2&gt;
&lt;h3&gt;9.1.1 Properties of Metals&lt;/h3&gt;
&lt;p&gt;半金属：semimetals, metalloids&lt;/p&gt;
&lt;p&gt;metal bond的强度可以由沸点得出（气体时原子都分开）&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Properties of metals&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;conduct heat and electricity(sea of delocalized electrons)&lt;/li&gt;
&lt;li&gt;malleable(can be hammered and made into different shapes压扁成一片) and ductile(can be drawn into wires(延展性))&lt;/li&gt;
&lt;li&gt;lustrous &amp;amp; shiny&lt;/li&gt;
&lt;li&gt;high density, high m.p.  (metallic bond -determined by-&amp;gt; number of delocalized electrons)&lt;/li&gt;
&lt;li&gt;form positive ions, basic oxides&lt;/li&gt;
&lt;li&gt;solid(except mercury)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Properties of non-metal&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Do not conduct heat and electricity(insulator)&lt;/li&gt;
&lt;li&gt;brittle(脆) when solid&lt;/li&gt;
&lt;li&gt;dull and nonreflective&lt;/li&gt;
&lt;li&gt;low density and low m.p.  (low的都是simple molecules. Giant covalent molecules还是很强的(diamond~3200, graphite~3400, silicon dioxide~2000))(看到3000优先想钻石石墨)&lt;/li&gt;
&lt;li&gt;form negative ions, acidic oxides&lt;/li&gt;
&lt;li&gt;solid, liquid(Br2...), gas&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;金属+冷水 -&amp;gt; 金属氢氧化物 + 氢气&lt;/p&gt;
&lt;p&gt;金属+蒸汽 -&amp;gt; 金属氧化物 + 氢气&lt;/p&gt;
&lt;p&gt;和酸：置换反应&lt;/p&gt;
&lt;p&gt;和氧气：氧化物&lt;/p&gt;
&lt;h3&gt;9.1.2 Uses of Metals(Al, Cu)&lt;/h3&gt;
&lt;p&gt;Uses of Al:&lt;/p&gt;
&lt;p&gt;(most abundance)(form a layer of aluminium oxide, which acts as a protective layer)&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;th&gt;Most Important Property&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Aircrafts bodies&lt;/td&gt;
&lt;td&gt;High strength-to-weight ratio, Low density&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Overhead power cables&lt;/td&gt;
&lt;td&gt;Good conductor of electricity, Low density&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Saucepans&lt;/td&gt;
&lt;td&gt;Good conductor of heat&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Food containers&lt;/td&gt;
&lt;td&gt;Non-toxic, Resistant to corrosion and acidic food stuffs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Window frames&lt;/td&gt;
&lt;td&gt;Resistant to corrosion&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Uses of Cu:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;th&gt;Most Important Property&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Electrical wires&lt;/td&gt;
&lt;td&gt;Good conductor of electricity, High ductility&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Water pipes&lt;/td&gt;
&lt;td&gt;Easy to bend, Non-toxic, Unreactive&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;9.1.3 Alloys(合金)&lt;/h3&gt;
&lt;p&gt;Alloys: mixture of metal with other elements&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Alloy&lt;/th&gt;
&lt;th&gt;Components&lt;/th&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;th&gt;Reason 4 Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Brass&lt;/td&gt;
&lt;td&gt;Cu+Zn&lt;/td&gt;
&lt;td&gt;Musical instruments, Ornaments(饰品), Door knobs&lt;/td&gt;
&lt;td&gt;Hard, Malleable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stainless steel&lt;/td&gt;
&lt;td&gt;Fe+Others(Cr, Ni, C)&lt;/td&gt;
&lt;td&gt;Cutlery(切具)&lt;/td&gt;
&lt;td&gt;Hard, Resistant to corrosion&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Cr可以让成品更shiny, 好看&lt;/p&gt;
&lt;p&gt;Alloys通常harder, stronger, more useful, resistant to corrosion / extreme temperatures&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Structure&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Metal: regular arrangement of ions&lt;/p&gt;
&lt;p&gt;Alloys: irregular arrangement of atoms&lt;/p&gt;
&lt;p&gt;The metal lattice structure is distorted(扭曲) in alloys&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reason 4 the Properties&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;atoms of different sizes -&amp;gt; distorts the normally regular arrangements of atoms in metals -&amp;gt; more difficult for the layers to slide over each other -&amp;gt; harder / stronger&lt;/p&gt;
&lt;h2&gt;9.2 Reactivity Series &amp;amp; Corrosion of Metals&lt;/h2&gt;
&lt;h3&gt;9.2.1 Reactivity Series&lt;/h3&gt;
&lt;p&gt;方法：displacement reactions(substitution)&lt;/p&gt;
&lt;p&gt;K,Na,Ca,Mg,Al,(C),Zn,Fe,(H),Cu,Hg,Ag,Pt,Au&lt;/p&gt;
&lt;p&gt;钾钠钙(钙钠)镁铝&lt;/p&gt;
&lt;p&gt;(碳)锌铁(氢)&lt;/p&gt;
&lt;p&gt;铜汞银铂金&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2022/07/O-jBl2PX_9-2-1-reactivity-series.png&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;四种金属反应&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Metal + Acid -&amp;gt; Salt + Hydrogen：氢之前&lt;/p&gt;
&lt;p&gt;Metal+ Water-&amp;gt; Hydroxide + Hydrogen：钾钠钙&lt;/p&gt;
&lt;p&gt;Metal + Steam -&amp;gt; Oxide + Hydrogen：氢之前&lt;/p&gt;
&lt;p&gt;Metal + Oxygen -&amp;gt; Oxide：氢之前+铜&lt;/p&gt;
&lt;p&gt;CuO：黑的&lt;/p&gt;
&lt;h3&gt;9.2.2 Explaining Reactivity&lt;/h3&gt;
&lt;p&gt;Al: a protective layer of aluminium oxide which is very thin (prevents reaction with water and dilute acids)&lt;/p&gt;
&lt;h3&gt;9.2.3 Rusting of Iron&lt;/h3&gt;
&lt;p&gt;Rusting: Iron专属   Corrosion: 所有metal都有&lt;/p&gt;
&lt;p&gt;iron + water + oxygen -&amp;gt; hydrated iron(III) oxide(氧化铁)&lt;/p&gt;
&lt;p&gt;防止生锈：barrier methods, painting, plastic coating(还有后面的两个)&lt;/p&gt;
&lt;p&gt;grease: oil&lt;/p&gt;
&lt;p&gt;paint: plastic&lt;/p&gt;
&lt;p&gt;iron &amp;amp; steel: rust&lt;/p&gt;
&lt;p&gt;other metal: corroded&lt;/p&gt;
&lt;h3&gt;9.2.4 Galvanising &amp;amp; Sacrificial(牺牲) Protection&lt;/h3&gt;
&lt;p&gt;Sacrificial protection: a more reactive metal can be attached to a less reactive metal&lt;/p&gt;
&lt;p&gt;zinc is sacrificed to protect the steel&lt;/p&gt;
&lt;p&gt;electrons travel from the zinc to th&lt;/p&gt;
&lt;p&gt;galvanising(镀锌): a process where the iron to be protected is coated with a layer of zinc&lt;/p&gt;
&lt;h2&gt;9.3 Extraction of Metals&lt;/h2&gt;
&lt;h3&gt;9.3.1 Extraction of Metals&lt;/h3&gt;
&lt;p&gt;Metal ore: a rock that contains enough of the metal to make it worthwhile extracting&lt;/p&gt;
&lt;p&gt;Methods:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Electrolysis aqueous solutions containing their ions&lt;/li&gt;
&lt;li&gt;using blast furnace / react with more reactive material&lt;/li&gt;
&lt;li&gt;碳之下：和碳或一氧化碳还原&lt;/li&gt;
&lt;li&gt;碳之上：电解熔融氧化物/氯化物 (贵)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Reduction: 很多矿石是氧化物。移除氧是还原反应&lt;/p&gt;
&lt;p&gt;Native metals: gold, platinum(chemical stability, 不用提取)&lt;/p&gt;
&lt;h3&gt;9.3.2 Extraction of Iron from Hematite(赤铁矿)&lt;/h3&gt;
&lt;p&gt;Ores: Hematite(Fe2O3), Magnetite(Fe3O4), Fayalite (Fe2SiO4)&lt;/p&gt;
&lt;p&gt;blast furnace&lt;/p&gt;
&lt;p&gt;coke(C), hematite(Fe2O3, SiO2), limestone(CaCO3)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;burning of carbon to provide heat and produce CO2(Waste) C+O2 -&amp;gt; CO2 (exothermic)&lt;/li&gt;
&lt;li&gt;Reaction of carbon dioxide to carbon monoxide C+CO2 -&amp;gt; 2CO  (Good reducing agent)&lt;/li&gt;
&lt;li&gt;Reduction of iron(III) oxide by carbon monoxide Fe2O3 + 3CO -&amp;gt; Fe(l) + 3CO2&lt;/li&gt;
&lt;li&gt;Thermal decomposition of calcium carbonate / limestone to produce calcium oxide CaCO3 -&amp;gt; CaO(s)+CO2&lt;/li&gt;
&lt;li&gt;Formation of slag(不要的那些impurities) CaO + SiO2(s) -&amp;gt; CaSiO3(l)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Slag比Iron轻&lt;/p&gt;
&lt;p&gt;写方程式记得铁和slag是liquid, CaO是solid&lt;/p&gt;
&lt;h3&gt;9.3.3 Extraction of Aluminium from Bauxite(!)&lt;/h3&gt;
&lt;p&gt;Al2O3&lt;/p&gt;
&lt;p&gt;Electrolysis&lt;/p&gt;
&lt;p&gt;(~2000°C)Molten aluminium oxide (impure) / bauxite + cryolite&lt;/p&gt;
&lt;p&gt;2000°C加了cryolite降到1000°C&lt;/p&gt;
&lt;p&gt;Cryolite可以1. 增加导电性 2. 降低操作时的温度&lt;/p&gt;
&lt;p&gt;电极用石墨&lt;/p&gt;
&lt;p&gt;Cathode: Al3+  +  3e-  -&amp;gt; Al(在cell底部(siphoned(虹吸) off from time to time))&lt;/p&gt;
&lt;p&gt;Anode: 2O2-  -&amp;gt;  O2 + 4e- (need to be regularly replaced (reacts with oxygen))&lt;/p&gt;
&lt;p&gt;贵-&amp;gt;用很多电&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2019/12/Aluminium-extraction.png&quot; alt=&quot;Aluminium extraction, IGCSE &amp;amp; GCSE Chemistry revision notes&quot; /&gt;&lt;/p&gt;
&lt;h1&gt;10. Chemistry of the Environment&lt;/h1&gt;
&lt;p&gt;Simon 学案&lt;/p&gt;
&lt;h2&gt;10.1 Water &amp;amp; Water Pollution&lt;/h2&gt;
&lt;h3&gt;10.1.1 Water: Chemical Tests&lt;/h3&gt;
&lt;h3&gt;10.1.2 Substances in Water from Natural Sources&lt;/h3&gt;
&lt;h3&gt;10.1.3 Water Treatment&lt;/h3&gt;
&lt;h3&gt;10.1.4 Fertilisers&lt;/h3&gt;
&lt;h2&gt;10.2 Air Quality &amp;amp; Climate&lt;/h2&gt;
&lt;h3&gt;10.2.1 Air&lt;/h3&gt;
&lt;h3&gt;10.2.2 Effects of Greenhouse Gases&lt;/h3&gt;
&lt;h3&gt;10.2.3 Reducing the Effects of Environmental Issues&lt;/h3&gt;
&lt;h3&gt;10.2.4 Photosynthesis&lt;/h3&gt;
&lt;h1&gt;11. Organic Chemistry&lt;/h1&gt;
&lt;p&gt;Organic Chemistry: The scientific study of the structure, properties, and reactions of organic compounds.&lt;/p&gt;
&lt;p&gt;(老师ppt上): the study of structure, properties, composition, reactions, and preparation of carbon-containing compounds. (excluding simple compounds like CO, CO~2~, CO~3~^2-^)&lt;/p&gt;
&lt;p&gt;Most organic compounds contain carbon and hydrogen m but they may also include any number of other elements, such as nitrogen, oxygen, halogens, phosphorus, silicon, and sulfur&lt;/p&gt;
&lt;h2&gt;11.1 Formulae, Functional Groups &amp;amp; Terminology&lt;/h2&gt;
&lt;h3&gt;11.1.1 Organic Formulae&lt;/h3&gt;
&lt;p&gt;Organic compounds: those which contain carbon (不包括metal carbonates, carbon dioxide and carbon monoxide)&lt;/p&gt;
&lt;p&gt;Hydrocarbon: a compound that contains &lt;strong&gt;only&lt;/strong&gt; hydrogen and carbon atoms&lt;/p&gt;
&lt;p&gt;表示方法：empirical formula, displayed formulae, general formulae, structural formulae&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Empirical Formula(C2H5)&lt;/strong&gt;: simplest ratio of atoms&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Molecular Formula(C4H10)&lt;/strong&gt;: Actual number of atoms of each element in a compound&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Displayed Formulae(a diagram):&lt;/strong&gt; shows the spatial arrangement of all the atoms and bonds in a molecule&lt;/p&gt;
&lt;p&gt;**Structural Formulae(CH3CH2CH2CH3): **shows the order and arrangement of atoms&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;only show important bonds(double and triple bonds)&lt;/li&gt;
&lt;li&gt;identical groups / side groups: 打括号&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;*&lt;strong&gt;Skeletal Formula&lt;/strong&gt;: All C, H and C-H bonds are removed&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;structure isomers:&lt;/strong&gt; same molecular formulae, different structural formulae (structural isomerism)&lt;/p&gt;
&lt;p&gt;如果是C~n~H~2n~考虑两种情况，double bond 或者 ring !!!!!&lt;/p&gt;
&lt;p&gt;carbon: can form 4 bonds&lt;/p&gt;
&lt;h3&gt;11.1.2 Homologous Series&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Functional Group&lt;/strong&gt;: an atom or group of atoms which are bonded in a specific arrangement that is responsible for the characteristic reactions of each member of a homologous series.&lt;/p&gt;
&lt;p&gt;-&amp;gt; dictates their physical and chemical properties&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Homologous Series&lt;/strong&gt;: a family of organic compounds that have similar features and chemical properties due to them have the same functional group&lt;/p&gt;
&lt;p&gt;-&amp;gt; same functional group&lt;/p&gt;
&lt;p&gt;-&amp;gt; same general formula&lt;/p&gt;
&lt;p&gt;-&amp;gt; similar chemical properties&lt;/p&gt;
&lt;p&gt;-&amp;gt; gradual change in physical properties&lt;/p&gt;
&lt;p&gt;-&amp;gt; differing form one member to the next by a -CH~2~- unit&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Family(Homologous Series)&lt;/th&gt;
&lt;th&gt;中文&lt;/th&gt;
&lt;th&gt;Functional Group&lt;/th&gt;
&lt;th&gt;Suffix/Preffix&lt;/th&gt;
&lt;th&gt;General Formulae&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Alkane&lt;/td&gt;
&lt;td&gt;烷&lt;/td&gt;
&lt;td&gt;C-C&lt;/td&gt;
&lt;td&gt;-ane&lt;/td&gt;
&lt;td&gt;C~n~H~2n+2~&lt;/td&gt;
&lt;td&gt;Methane&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alkene&lt;/td&gt;
&lt;td&gt;烯&lt;/td&gt;
&lt;td&gt;C=C&lt;/td&gt;
&lt;td&gt;-ene&lt;/td&gt;
&lt;td&gt;C~n~H~2n~&lt;/td&gt;
&lt;td&gt;Ethene&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alkyne&lt;/td&gt;
&lt;td&gt;炔&lt;/td&gt;
&lt;td&gt;C≡C&lt;/td&gt;
&lt;td&gt;-yne&lt;/td&gt;
&lt;td&gt;C~n~H~2n-2~&lt;/td&gt;
&lt;td&gt;Ethyne&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Halogenoalkane&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;-X&lt;/td&gt;
&lt;td&gt;halo- (fluoro-, chloro-, bromo- )&lt;/td&gt;
&lt;td&gt;C~n~H~2n+1~X&lt;/td&gt;
&lt;td&gt;Fluoromethane&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alcohol&lt;/td&gt;
&lt;td&gt;醇&lt;/td&gt;
&lt;td&gt;-OH&lt;/td&gt;
&lt;td&gt;-(an)ol&lt;/td&gt;
&lt;td&gt;C~n~H~2n+1~OH&lt;/td&gt;
&lt;td&gt;methanol&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carboxylic Acid&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;-COOH&lt;/td&gt;
&lt;td&gt;-(an)oic acid&lt;/td&gt;
&lt;td&gt;C~n~H~2n+1~COOH&lt;/td&gt;
&lt;td&gt;methanoic acid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ester&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;-COO-&lt;/td&gt;
&lt;td&gt;-yl-anoate&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;methyl methanoate&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;General Formula&lt;/strong&gt;: A type of empirical formula that represents the composition of any member of a whole homologous series of organic compound&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;General Characteristic of Homologous Series&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;-&amp;gt; The same general formulae&lt;/p&gt;
&lt;p&gt;-&amp;gt; same functional group&lt;/p&gt;
&lt;p&gt;-&amp;gt; similar chemical properties&lt;/p&gt;
&lt;p&gt;-&amp;gt; Gradation in their physical properties&lt;/p&gt;
&lt;p&gt;-&amp;gt; The difference in the molecular formula between one member and the next is CH~2~&lt;/p&gt;
&lt;p&gt;Meth, Eth, Prop, But (Monkeys Eat Peeled Bananas)&lt;/p&gt;
&lt;h3&gt;11.1.3 Saturated &amp;amp; Unsaturated Compounds&lt;/h3&gt;
&lt;p&gt;Saturated compounds: have molecules in which all carbon-carbon bonds are single bonds (e.g. alkanes)&lt;/p&gt;
&lt;p&gt;Unsaturated compounds: consist of molecules in which one or more carbon-carbon bonds are not single bonds (e.g. alkenes, carboxylic acid)&lt;/p&gt;
&lt;h3&gt;11.1.4 Naming Organic Compounds(!)&lt;/h3&gt;
&lt;p&gt;Substituents: 替换掉有机物里的氢的东西（比如CH4去掉一个H加一个F）&lt;/p&gt;
&lt;p&gt;IUPAC: International Union of Pure and Applied Chemistry&lt;/p&gt;
&lt;p&gt;IUPAC naming system: Prefix - Parent - Suffix&lt;/p&gt;
&lt;p&gt;-&amp;gt; Prefix: Name and position of substituents&lt;/p&gt;
&lt;p&gt;-&amp;gt; Parent: Length of the longest carbon chain&lt;/p&gt;
&lt;p&gt;-&amp;gt; Suffix: Main functional group&lt;/p&gt;
&lt;p&gt;两个部分：the stem, end part (prefix, suffix)&lt;/p&gt;
&lt;p&gt;The stem: indicates the number of carbon atoms present in the longest continuous chain of the compound&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;# of C in the longest chain&lt;/th&gt;
&lt;th&gt;The stem&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;meth&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;eth&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;prop&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;but(u读you的音)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;pent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;hex&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;hept&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;oct&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;non&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;dec&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;undec&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;dodec&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Substituent&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Alkyl Group&lt;/th&gt;
&lt;th&gt;Structural Formula&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;-CH3&lt;/td&gt;
&lt;td&gt;-CH3&lt;/td&gt;
&lt;td&gt;Methyl&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-C2H5&lt;/td&gt;
&lt;td&gt;-CH2CH3&lt;/td&gt;
&lt;td&gt;Ethyl&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-C3H7&lt;/td&gt;
&lt;td&gt;-CH2CH2CH3&lt;/td&gt;
&lt;td&gt;Propyl&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-C4H9&lt;/td&gt;
&lt;td&gt;-CH2CH2CH2CH3&lt;/td&gt;
&lt;td&gt;Butyl&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;# of substituents&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Mono&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Di&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Tri&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Tetra&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Penta&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;例子： 2-methylbutane      2,3-dimethylbutane&lt;/p&gt;
&lt;p&gt;The end part: tells you what functional group is in the compound&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;End part of the name&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Functional group&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Organic family&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ane&lt;/td&gt;
&lt;td&gt;none (contains only C-C bonds)&lt;/td&gt;
&lt;td&gt;Alkane&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ene&lt;/td&gt;
&lt;td&gt;C=C bond&lt;/td&gt;
&lt;td&gt;Alkene&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;anol&lt;/td&gt;
&lt;td&gt;–OH&lt;/td&gt;
&lt;td&gt;Alcohol&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;anoic acid&lt;/td&gt;
&lt;td&gt;–COOH&lt;/td&gt;
&lt;td&gt;Carboxylic acid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;amine&lt;/td&gt;
&lt;td&gt;–NH2&lt;/td&gt;
&lt;td&gt;Amine&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-yl -anoate&lt;/td&gt;
&lt;td&gt;–COO–&lt;/td&gt;
&lt;td&gt;Ester&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;butanoic acid&lt;/p&gt;
&lt;p&gt;propene&lt;/p&gt;
&lt;p&gt;pentanol&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;高级命名法&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;需要指定functional group出现在哪一个carbon atom 上面（数字越小越好）&lt;/p&gt;
&lt;p&gt;-an: 单键  -en: 双键&lt;/p&gt;
&lt;p&gt;在propene之后，要指定双键出现在哪里（e.g. but-1-ene, but-2-ene)&lt;/p&gt;
&lt;p&gt;-OH: alcohol / hydroxyl group&lt;/p&gt;
&lt;p&gt;和ene一样，在ethanol之后要指定在哪（e.g. propan-1-ol, propan-2-ol)&lt;/p&gt;
&lt;p&gt;carboxylic acid很伟大，不用指定。默认出现在1号位&lt;/p&gt;
&lt;p&gt;Ester: 基于原先的alcohol和carboxylic acid，比较复杂，和structure的画法相反&lt;/p&gt;
&lt;p&gt;原子越多燃烧放出的re&apos;liang&lt;/p&gt;
&lt;h2&gt;11.2 Organic Families(!)&lt;/h2&gt;
&lt;h3&gt;11.2.1 Fossil Fuels&lt;/h3&gt;
&lt;p&gt;Fossil fuels: release a large amount of energy when burned&lt;/p&gt;
&lt;p&gt;三大类：Coal / Natural Gas(主要是CH4) / Petroleum (mixture of hydrocarbons)&lt;/p&gt;
&lt;p&gt;petroleum的分离方式：fractional distillation&lt;/p&gt;
&lt;p&gt;气体从塔下面被heater加热后，顺着塔向上走&lt;/p&gt;
&lt;p&gt;塔从下往上的趋势：&lt;/p&gt;
&lt;p&gt;-&amp;gt; lower boiling point&lt;/p&gt;
&lt;p&gt;-&amp;gt; decreasing chain length&lt;/p&gt;
&lt;p&gt;-&amp;gt; higher volatility (挥发性)&lt;/p&gt;
&lt;p&gt;-&amp;gt; lower viscosity (流动性)&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Temp&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;Refinery Gas&lt;/td&gt;
&lt;td&gt;for gas used in heating and cooking&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;40&lt;/td&gt;
&lt;td&gt;Gasoline&lt;/td&gt;
&lt;td&gt;for fuel used in cars&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;110&lt;/td&gt;
&lt;td&gt;Naphtha(石脑油)&lt;/td&gt;
&lt;td&gt;as chemical feedstock&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;180&lt;/td&gt;
&lt;td&gt;Kerosene / Paraffin(煤油)&lt;/td&gt;
&lt;td&gt;for jet fuel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;260&lt;/td&gt;
&lt;td&gt;Diesel oil / Gas oil(柴油)&lt;/td&gt;
&lt;td&gt;for fuel used in diesel engines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;280&lt;/td&gt;
&lt;td&gt;Fuel oil&lt;/td&gt;
&lt;td&gt;for fuel used in ships and home heating systems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;Lubricating oil&lt;/td&gt;
&lt;td&gt;for lubricants, waxes and polishes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;340&lt;/td&gt;
&lt;td&gt;Bitumen(沥青)&lt;/td&gt;
&lt;td&gt;for making roads&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;11.2.2 Alkanes(烷烃)&lt;/h3&gt;
&lt;p&gt;saturated hydrocarbons&lt;/p&gt;
&lt;p&gt;C~n~H~2n+2~&lt;/p&gt;
&lt;p&gt;cycloalkanes会少两个H&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;物理性质：&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;b.p.和m.p.：&lt;/p&gt;
&lt;p&gt;-&amp;gt; 分子越大bpmp越大&lt;/p&gt;
&lt;p&gt;-&amp;gt; chain越straight(没什么branches)bpmp越大&lt;/p&gt;
&lt;p&gt;Solubility:&lt;/p&gt;
&lt;p&gt;-&amp;gt; Insoluble&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;化学性质：&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Unreactive&lt;/p&gt;
&lt;p&gt;-&amp;gt; C and H have similar electronegativities&lt;/p&gt;
&lt;p&gt;-&amp;gt; strong and non-polar C-C and C-H bonds&lt;/p&gt;
&lt;p&gt;想要react的话也有&lt;/p&gt;
&lt;p&gt;-&amp;gt; Combustion（燃烧）: Carbon dioxide / monoxide&lt;/p&gt;
&lt;p&gt;Reagents 1: Excess O~2~ (Complete combustion)（reagent：和reactant差不多，是加入到原本物质的一方）&lt;/p&gt;
&lt;p&gt;Reagents 2: Limited O2 (Incomplete combustion) (就是氧气没那么足)&lt;/p&gt;
&lt;p&gt;Conditions: Room temperature&lt;/p&gt;
&lt;p&gt;Equation 1: C~x~H~y~ + O~2~  ---&amp;gt; x CO~2~ + y H~2~O  (O~2~要配平) (Complete, 燃烧产生CO~2~)&lt;/p&gt;
&lt;p&gt;Equation 2: C~x~H~y~ + O~2~  ---&amp;gt; x ==CO== + y H~2~O  (O~2~要配平) (Incomplete, 燃烧产生CO)&lt;/p&gt;
&lt;p&gt;-&amp;gt; Substitution（比如一个H变成Cl） : Halogenoalkanes&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;reactions in which one atom or group of atoms is replaced by another atom or group of atoms&lt;/p&gt;
&lt;p&gt;具体来说，这里的substitution是==halogenation== (把一个东西换成halogen)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Reagents: Halogens(Cl~2~ , Br~2~ ...)&lt;/p&gt;
&lt;p&gt;Conditions: ==Ultraviolet light==&lt;/p&gt;
&lt;p&gt;Equation: CH~4~ + Cl~2~  --(UV light)--&amp;gt;  CH~3~Cl + HCl  (把一个H换成Cl) (CH~3~Cl: ==Chloromethane==)&lt;/p&gt;
&lt;p&gt;(有UV light参与所以也是photochemical reaction)&lt;/p&gt;
&lt;p&gt;-&amp;gt; Cracking （断键） : Alkenes + Alkanes or Hydrogen&lt;/p&gt;
&lt;p&gt;High temp. &amp;amp; press. (or catalyst + heat)&lt;/p&gt;
&lt;h3&gt;11.2.3 Alkenes(!!)&lt;/h3&gt;
&lt;h3&gt;11.2.4 Addition Reactions(!!)&lt;/h3&gt;
&lt;h3&gt;11.2.5 Alcohols&lt;/h3&gt;
&lt;p&gt;Alcohol: One or more H atoms in an alkane have been replaced by OH groups&lt;/p&gt;
&lt;p&gt;General formula: C~n~H~2n+1~OH&lt;/p&gt;
&lt;p&gt;Physical properties:&lt;/p&gt;
&lt;p&gt;-&amp;gt; soluble in water&lt;/p&gt;
&lt;p&gt;-&amp;gt; High boiling point (78 for ethanol)&lt;/p&gt;
&lt;p&gt;Usage:&lt;/p&gt;
&lt;p&gt;-&amp;gt; solvent&lt;/p&gt;
&lt;p&gt;-&amp;gt; Fuel&lt;/p&gt;
&lt;p&gt;Reactions:&lt;/p&gt;
&lt;p&gt;-&amp;gt;&lt;/p&gt;
&lt;p&gt;Alkenes --(Catalytic Addition of H~2~O(g))--&amp;gt; Alcohols&lt;/p&gt;
&lt;p&gt;Glucose --(Fermentation)--&amp;gt; Alcohols&lt;/p&gt;
&lt;p&gt;Alcohols --&amp;gt; Combustion (CO~2~/CO) / Oxidation(Carboxylic acids) / Esterification(Esters)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Forming&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;-&amp;gt; Hydration&lt;/p&gt;
&lt;p&gt;CH~2~=CH~2~ + H~2~O(steam, g)  --(H~3~PO~4~ ， 300C, 60atm) --&amp;gt; CH~3~CH~2~OH&lt;/p&gt;
&lt;p&gt;High Purity, High yield, Non-renewable, Continuous flow process, one product formed&lt;/p&gt;
&lt;p&gt;High energy cost&lt;/p&gt;
&lt;p&gt;-&amp;gt; Fermentation&lt;/p&gt;
&lt;p&gt;C~6~H~12~O~6~(Glucose) --(Yeast, 25C~35C) --&amp;gt; 2C~2~H~5~OH + 2CO~2~&lt;/p&gt;
&lt;p&gt;High alcohol kills the yeast! (12% ~ 17%) , Renewable, low energy cost&lt;/p&gt;
&lt;p&gt;batch process (fixed amount) , Occupied space&lt;/p&gt;
&lt;p&gt;Beers / Wines&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reacting&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;-&amp;gt; Combustion&lt;/p&gt;
&lt;p&gt;C~2~H~5~OH + 3O~2~(Excess) --&amp;gt; 2CO~2~ + 3H~2~O&lt;/p&gt;
&lt;p&gt;C~2~H~5~OH + 2O~2~(Limited) --&amp;gt; 2CO + 3H~2~O&lt;/p&gt;
&lt;p&gt;-&amp;gt; Oxidation&lt;/p&gt;
&lt;p&gt;Acidified potassium dichromate(VI) - K~2~Cr~2~O~7~&lt;/p&gt;
&lt;p&gt;Orange to Green (Cr~2~O~7~^2-^ -&amp;gt; Cr^3+^)&lt;/p&gt;
&lt;p&gt;Acidified potassium manganate(VII) - KMnO~4~&lt;/p&gt;
&lt;p&gt;Purple to Colourless (MnO~4~^-^ -&amp;gt; Mn^2+^)&lt;/p&gt;
&lt;p&gt;Conditions: Heat under reflux&lt;/p&gt;
&lt;p&gt;Equation: CH~3~CH~2~CH~2~(OH) + 2[O] --(reflux / H^+^) --&amp;gt; CH~3~CH~2~COOH + H~2~O&lt;/p&gt;
&lt;p&gt;-&amp;gt; Bacterial Oxidation&lt;/p&gt;
&lt;p&gt;Reagents: O~2~&lt;/p&gt;
&lt;p&gt;Equation: CH~3~CH~2~CH~2~(OH) + O~2~ --(Enzymes in bacteria) --&amp;gt; CH~3~CH~2~COOH + H~2~O&lt;/p&gt;
&lt;p&gt;(production of vinegar)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reflux Heating&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A solution may be heated to a boiling point without losing the solvent to evaporation&lt;/p&gt;
&lt;p&gt;Increasing the number of vaporization - condensation cycles that the vapor undergoes&lt;/p&gt;
&lt;p&gt;-&amp;gt; Esterification&lt;/p&gt;
&lt;p&gt;conditions: concentrated H~2~SO~4~ or H~3~PO~4~&lt;/p&gt;
&lt;p&gt;CH~3~CH~2~OH + CH~3~CO~2~H --(H^+^, reflux) --&amp;gt; CH~3~CO~2~CH~2~CH~3~ + H~2~O&lt;/p&gt;
&lt;h3&gt;11.2.6 Carboxylic Acids&lt;/h3&gt;
&lt;p&gt;Physical properties:&lt;/p&gt;
&lt;p&gt;-&amp;gt; b.p.随分子大小的增加而增加&lt;/p&gt;
&lt;p&gt;-&amp;gt; b.p. 比对应大小的alkene更高&lt;/p&gt;
&lt;p&gt;-&amp;gt; soluble in water&lt;/p&gt;
&lt;p&gt;-&amp;gt; high b.p.&lt;/p&gt;
&lt;p&gt;Reaction:&lt;/p&gt;
&lt;p&gt;redox with metals -&amp;gt; Carboxylates&lt;/p&gt;
&lt;p&gt;neutralization with alkalis -&amp;gt; Carboxylates&lt;/p&gt;
&lt;p&gt;acid-base with carbonates -&amp;gt; Carboxylates&lt;/p&gt;
&lt;p&gt;Esterification -&amp;gt; Esters&lt;/p&gt;
&lt;p&gt;-&amp;gt; Redox with metals&lt;/p&gt;
&lt;p&gt;2CH~3~CO~2~H + 2Na --&amp;gt; 2CH~3~CO~2~Na + H~2~&lt;/p&gt;
&lt;p&gt;sodium ethanoate: CH~3~CO~2~Na&lt;/p&gt;
&lt;p&gt;-&amp;gt; Neutralization with Alkalis&lt;/p&gt;
&lt;p&gt;CH~3~CO~2~H + NaOH --&amp;gt; CH~3~CO~2~Na + H~2~O&lt;/p&gt;
&lt;p&gt;-&amp;gt; Acid-base with Carbonates&lt;/p&gt;
&lt;p&gt;2CH~3~CO~2~H + Na~2~CO~3~ --&amp;gt; CH~3~CO~2~Na + CO~2~ + 2H~2~O&lt;/p&gt;
&lt;p&gt;-&amp;gt; Esterification&lt;/p&gt;
&lt;p&gt;CH~3~CO~2~H + CH~3~CH~2~OH --(H^+^, Reflux) --&amp;gt; CH~3~CO~2~CH~2~CH~3~ + H~2~O&lt;/p&gt;
&lt;p&gt;CH~3~CO~2~CH~2~CH~3~: ethyl ethanoate&lt;/p&gt;
&lt;p&gt;和上面的一样&lt;/p&gt;
&lt;h3&gt;11.2.7 Ethanoic Acid &amp;amp; Esterification Reactions&lt;/h3&gt;
&lt;h2&gt;11.3 Polymers(!)&lt;/h2&gt;
&lt;h3&gt;11.3.1 Polymers&lt;/h3&gt;
&lt;h3&gt;11.3.2 Addition &amp;amp; Condensation Polymers&lt;/h3&gt;
&lt;h3&gt;11.3.3 Plastics &amp;amp; their Disposal&lt;/h3&gt;
&lt;h3&gt;11.3.4 Proteins&lt;/h3&gt;
&lt;h1&gt;12. Experimental Techniques &amp;amp; Chemical Analysis&lt;/h1&gt;
&lt;p&gt;Polystyrene Cup: minimize th&lt;/p&gt;
&lt;h2&gt;12.1 Experimental Techniques&lt;/h2&gt;
&lt;h3&gt;12.1.1 Apparatus for Measurements&lt;/h3&gt;
&lt;p&gt;time: stopwatch&lt;/p&gt;
&lt;p&gt;temp: thermometer / digital probe&lt;/p&gt;
&lt;p&gt;mass: digital balance(needs to be tared(set to zero))&lt;/p&gt;
&lt;p&gt;volume-liquids&lt;/p&gt;
&lt;p&gt;(measuring cylinders)&lt;/p&gt;
&lt;p&gt;graduated: 带有刻度的&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2019/12/Equipment-used-for-measuring-liquids.png&quot; alt=&quot;Equipment used for measuring liquids, IGCSE &amp;amp; GCSE Chemistry revision notes&quot; /&gt;&lt;/p&gt;
&lt;p&gt;volume-gases&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2019/12/Equipment-used-to-collect-gas-from-chemical-reactions.png&quot; alt=&quot;Equipment used to collect gas from chemical reactions, IGCSE &amp;amp; GCSE Chemistry revision notes&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Advantage &amp;amp; Disadvantage&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2022/07/12-1-1-advantages--disadvantages-of-lab-apparatus.png&quot; alt=&quot;12-1-1-advantages--disadvantages-of-lab-apparatus&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;12.1.2 Solutions&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2023/05/12-1-2-solutions.png&quot; alt=&quot;12-1-2-solutions&quot; /&gt;&lt;/p&gt;
&lt;p&gt;residue [ˈrezɪdjuː]&lt;/p&gt;
&lt;h3&gt;12.1.3 Acid-Base Titrations&lt;/h3&gt;
&lt;p&gt;细节懒得写了&lt;/p&gt;
&lt;p&gt;Common acid-base indicators&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Indicator&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Colour in acid&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Colour in alkali&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Colour in neutral&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Litmus solution&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Red&lt;/td&gt;
&lt;td&gt;Blue&lt;/td&gt;
&lt;td&gt;Purple&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Red litmus paper&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Stays red&lt;/td&gt;
&lt;td&gt;Turns blue&lt;/td&gt;
&lt;td&gt;No change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Blue litmus paper&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Turns red&lt;/td&gt;
&lt;td&gt;Stays blue&lt;/td&gt;
&lt;td&gt;No change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Methyl orange&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Red&lt;/td&gt;
&lt;td&gt;Yellow&lt;/td&gt;
&lt;td&gt;Orange&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Phenolphthalein&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Colourless&lt;/td&gt;
&lt;td&gt;Pink&lt;/td&gt;
&lt;td&gt;Colourless&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Thymolphthalein&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Colourless&lt;/td&gt;
&lt;td&gt;Blue&lt;/td&gt;
&lt;td&gt;Colourless&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;12.2 Separation &amp;amp; Purification&lt;/h2&gt;
&lt;h3&gt;12.2.1 Paper Chromatography(色谱法)&lt;/h3&gt;
&lt;p&gt;used to separate substances that have different solubilities in a given solvent&lt;/p&gt;
&lt;p&gt;capillary action: 毛细效应&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2019/12/Using-paper-chromatography-to-separate-soluble-mixtures.png&quot; alt=&quot;Using paper chromatography to separate soluble mixtures, IGCSE &amp;amp; GCSE Chemistry revision notes&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;12.2.2 Locating Agents &amp;amp; Rf  Values&lt;/h3&gt;
&lt;p&gt;locating agents: react with the sample and produce a coloured product which is then visible&lt;/p&gt;
&lt;p&gt;Rf Value(Retention Factor): distance travelled by substance / distance travelled by solvent&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2019/12/Using-Rf-values-to-identify-mixture-components.png&quot; alt=&quot;Using Rf values to identify mixture components, IGCSE &amp;amp; GCSE Chemistry revision notes&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;12.2.3 Separation &amp;amp; Purification Techniques&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Filtration&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;used to separate an undissolved solid from a mixture of the solid and a liquid / solution&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto,width=566,height=645/uploads/2019/12/Filtration-of-sand-water.png&quot; alt=&quot;Filtration of sand &amp;amp; water, IGCSE &amp;amp; GCSE Chemistry revision notes&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Crystallisation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;used to separate a dissolved solid from a solution, when the solid is more soluble in hot solvent than in cold&lt;/p&gt;
&lt;p&gt;saturated solution: 饱和溶液&lt;/p&gt;
&lt;p&gt;(dipping a clean, dry, cold glass rod into the solution)&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto,width=658,height=365/uploads/2019/12/Process-Of-Crystallisation.png&quot; alt=&quot;Process-Of Crystallisation, IGCSE &amp;amp; GCSE Chemistry revision notes&quot; /&gt;&lt;/p&gt;
&lt;p&gt;(还要用distilled water to remove any impurities and then allowed to dry)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Simple Distillation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;used to separate a liquid and soluble solid from a solution&lt;/p&gt;
&lt;p&gt;冷凝管：condenser&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2019/12/Simple-distillation-of-saltwater.png&quot; alt=&quot;Simple distillation of saltwater&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Fractional Distillation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;fractionating column&lt;/p&gt;
&lt;p&gt;thermometer: 温度计&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Assessing purity&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Pure substances: melt and boil at specific and sharp temp&lt;/p&gt;
&lt;p&gt;Mixtures: a range of melting and boiling points&lt;/p&gt;
&lt;p&gt;如果样本不纯：b.p.更高m.p.更低&lt;/p&gt;
&lt;h2&gt;12.3 Identification of Ions &amp;amp; Gases&lt;/h2&gt;
&lt;h3&gt;12.3.1 Identification of Anions&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2023/06/12-3-1-anions-tests.png&quot; alt=&quot;12-3-1-anions-tests&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;12.3.2 Identification of Cations&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2024/04/8-2-2-identification-of-ions-gas.png&quot; alt=&quot;8-2-2-identification-of-ions-gas&quot; /&gt;&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Additional Method&lt;/th&gt;
&lt;th&gt;KMnO4&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cl-&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Br-&lt;/td&gt;
&lt;td&gt;No color&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;I-&lt;/td&gt;
&lt;td&gt;Change orange&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;（Al,Zn)Excess-&amp;gt;amphoteric(两性的)可以和碱反应&lt;/p&gt;
&lt;p&gt;Clear: 像水一样可以看穿&lt;/p&gt;
&lt;p&gt;Colourless: 没有颜色&lt;/p&gt;
&lt;p&gt;flame test: blue Bunsen flame&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://microbenotes.com/wp-content/uploads/2022/09/Types-of-flames-produced-during-adjustment-of-the-air-hole-in-the-bunsen-burner..jpg&quot; alt=&quot;Types of flames produced during adjustment of the air hole in the bunsen burner.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2023/03/12-3-2-flame-tests-results.png&quot; alt=&quot;12-3-2-flame-tests-results&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://ts1.cn.mm.bing.net/th/id/R-C.2ffa7b757f8af17c6ea524b2ed25bd7b?rik=neOL%2bl2MtrdFmQ&amp;amp;riu=http%3a%2f%2fgaokaobang.oss-cn-beijing.aliyuncs.com%2fattachs%2fohr%2f2020%2f09%2f05%2f153108_5f533ebc54d7d.jpeg&amp;amp;ehk=pXSHXQqZ0hS04xWM2AU3GKHd3Rbt4pYmjhxnLxECrSI%3d&amp;amp;risl=&amp;amp;pid=ImgRaw&amp;amp;r=0&amp;amp;sres=1&amp;amp;sresct=1&quot; alt=&quot;高考化学之焰色反应重要考点_高考网&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;12.3.3 Identification of Gases&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920/uploads/2022/07/12-3-3--testing-gases.png&quot; alt=&quot;12-3-3--testing-gases&quot; /&gt;&lt;/p&gt;
&lt;p&gt;神秘化学知识&lt;/p&gt;
&lt;p&gt;离子：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Cr3+&lt;/td&gt;
&lt;td&gt;Green&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Mn2+&lt;/td&gt;
&lt;td&gt;Pink&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Fe2+&lt;/td&gt;
&lt;td&gt;Green&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Fe3+&lt;/td&gt;
&lt;td&gt;Orange&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Ni2+&lt;/td&gt;
&lt;td&gt;Green&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Cu2+&lt;/td&gt;
&lt;td&gt;Blue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Co2+&lt;/td&gt;
&lt;td&gt;Pink&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Zn2+, Na+, K+, Ca2+, Mg2+&lt;/td&gt;
&lt;td&gt;Colourless&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;区分Cl, Br, I的方法&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Cl-&lt;/th&gt;
&lt;th&gt;Br-&lt;/th&gt;
&lt;th&gt;I-&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;white&lt;/td&gt;
&lt;td&gt;cream&lt;/td&gt;
&lt;td&gt;yellow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;+Nh3 dissolve!&lt;/td&gt;
&lt;td&gt;x&lt;/td&gt;
&lt;td&gt;x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;x&lt;/td&gt;
&lt;td&gt;x&lt;/td&gt;
&lt;td&gt;+H2O2 yellow solution bubbling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;x&lt;/td&gt;
&lt;td&gt;+KMnO4 yellow solution&lt;/td&gt;
&lt;td&gt;+KMnO4 Brown solution&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.savemyexams.com/&quot;&gt;savemyexams&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Other internet resources ...&lt;/p&gt;
&lt;/blockquote&gt;
</content:encoded></item><item><title>Chapter 1-Physical quantities and units</title><link>https://blog.haoye.plus/posts/phy_chap1/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/phy_chap1/</guid><description>A-Level Physics Chapter 1</description><pubDate>Mon, 15 Sep 2025 00:00:00 GMT</pubDate><content:encoded>&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#1-physical-quantities-and-units&quot;&gt;1 Physical quantities and units&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#11-physical-quantities&quot;&gt;1.1 Physical quantities&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#12-si-units&quot;&gt;1.2 SI units&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#13-errors-and-uncertainties&quot;&gt;1.3 Errors and uncertainties&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#14-scalars-and-vectors&quot;&gt;1.4 Scalars and Vectors*&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1-measurements&quot;&gt;1.? Measurements&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#length&quot;&gt;Length&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#mass&quot;&gt;Mass&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#1-uncertainties&quot;&gt;1.?? Uncertainties&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;1 Physical quantities and units&lt;/h1&gt;
&lt;p&gt;Updated on 2025-10-31&lt;/p&gt;
&lt;h2&gt;1.1 Physical quantities&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;1 understand that deformation is caused by tensile or compressive forces (forces and deformations will be assumed to be in one dimension only)

2 understand and use the terms load, extension, compression and limit of proportionality

3 recall and use Hooke’s law

4 recall and use the formula for the spring constant k = F / x

5 define and use the terms stress, strain and the Young modulus

6 describe an experiment to determine the Young modulus of a metal in the form of a wire
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Physical quantity&lt;/strong&gt; := a quantity that can be measured and &lt;em&gt;consists of a numerical magnitude and unit&lt;/em&gt;.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Quantity&lt;/th&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Diameter of an atom&lt;/td&gt;
&lt;td&gt;$10^{−10} \mathrm{m}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wavelength of UV radiation&lt;/td&gt;
&lt;td&gt;$10 \mathrm{nm}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Height of an adult human&lt;/td&gt;
&lt;td&gt;$2 \mathrm{m}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Distance between Earth and Sun (1 AU)&lt;/td&gt;
&lt;td&gt;$1.5 × 10^{11} \mathrm{m}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mass of a hydrogen atom&lt;/td&gt;
&lt;td&gt;$10^{−27} \mathrm{kg}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mass of an adult human&lt;/td&gt;
&lt;td&gt;$70 \mathrm{kg}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mass of a car&lt;/td&gt;
&lt;td&gt;$1000 \mathrm{kg}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Seconds in a day&lt;/td&gt;
&lt;td&gt;$90 000 \mathrm{s}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Seconds in a year&lt;/td&gt;
&lt;td&gt;$3 × 10^7 \mathrm{s}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Speed of sound in air&lt;/td&gt;
&lt;td&gt;$300 \mathrm{ms^{−1}}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Power of a light bulb&lt;/td&gt;
&lt;td&gt;$60 \mathrm{W}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Atmospheric pressure&lt;/td&gt;
&lt;td&gt;$1 × 10^5 \mathrm{Pa}$&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;blockquote&gt;
&lt;p&gt;From Save My Exams&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For AS: $g = 9.81ms^{-2}$&lt;/p&gt;
&lt;h2&gt;1.2 SI units&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Base quantities&lt;/strong&gt; are the quantities on the basis of which other quantities are expressed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Derived quantities&lt;/strong&gt; are the quantities that are expressed in terms of base quantities.&lt;/p&gt;
&lt;p&gt;A derived quantity has an equation which links to other quantities (e.g. $F=ma$).&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Base Quantities&lt;/th&gt;
&lt;th&gt;SI Units&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Length&lt;/td&gt;
&lt;td&gt;metre ($\mathrm{m}$)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mass&lt;/td&gt;
&lt;td&gt;kilogram ($\mathrm{kg}$)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Time&lt;/td&gt;
&lt;td&gt;second ($\mathrm{s}$)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Current&lt;/td&gt;
&lt;td&gt;Ampere ($\mathrm{A}$)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Temperature&lt;/td&gt;
&lt;td&gt;Kelvin ($\mathrm{K}$)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amount of substance&lt;/td&gt;
&lt;td&gt;Molar ($\mathrm{mol}$)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Luminous intensity&lt;/td&gt;
&lt;td&gt;Candela ($\mathrm{cd}$)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Derived Quantities&lt;/th&gt;
&lt;th&gt;Units&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Power&lt;/td&gt;
&lt;td&gt;$\mathrm{kgm^2s^{-3}}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Charge&lt;/td&gt;
&lt;td&gt;$\mathrm{As}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Voltage&lt;/td&gt;
&lt;td&gt;$\mathrm{kgm^2s^{-3}A^{-1}}$&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor ($10^x$)&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Symbol&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;tera&lt;/td&gt;
&lt;td&gt;T&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;giga&lt;/td&gt;
&lt;td&gt;G&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;mega&lt;/td&gt;
&lt;td&gt;M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;kilo&lt;/td&gt;
&lt;td&gt;k&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-1&lt;/td&gt;
&lt;td&gt;deci&lt;/td&gt;
&lt;td&gt;d&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-2&lt;/td&gt;
&lt;td&gt;centi&lt;/td&gt;
&lt;td&gt;c&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-3&lt;/td&gt;
&lt;td&gt;milli&lt;/td&gt;
&lt;td&gt;m&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-6&lt;/td&gt;
&lt;td&gt;micro&lt;/td&gt;
&lt;td&gt;μ&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-9&lt;/td&gt;
&lt;td&gt;nano&lt;/td&gt;
&lt;td&gt;n&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-12&lt;/td&gt;
&lt;td&gt;pico&lt;/td&gt;
&lt;td&gt;p&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;Homogeneity of an equation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;An equation is &lt;strong&gt;homogeneous&lt;/strong&gt; if quantities on BOTH sides of the equation has the same unit.&lt;/p&gt;
&lt;p&gt;A homogeneous equation may not be physically correct, but a physically correct equation will always be homogeneous.&lt;/p&gt;
&lt;p&gt;:::note[question]
The speed $v$ of a liquid leaving a tube depends on the change in pressure $\Delta P$ and the density $\rho$ of the liquid. The speed is given by the equation&lt;/p&gt;
&lt;p&gt;$$
v = k(\frac{\Delta P}{\rho})^n
$$&lt;/p&gt;
&lt;p&gt;Where k is a constant that has no units&lt;/p&gt;
&lt;p&gt;What is the value of n?
:::&lt;/p&gt;
&lt;p&gt;:::tip[Significant figures]
Digits considered &lt;em&gt;significant&lt;/em&gt;: non-zero digits, zeros who:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;appearing anywhere between two non-zero digits&lt;/li&gt;
&lt;li&gt;trailing zeros in a number containing a decimal point&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Digits considered &lt;em&gt;not significant&lt;/em&gt;: leading zeros, trailing zeros in a number without a decimal point
:::&lt;/p&gt;
&lt;h2&gt;1.3 Errors and uncertainties&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Random errors&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;values are scattered about the true value&lt;/li&gt;
&lt;li&gt;can be reduced by average / take readings in different ways (e.g. different points along a wire)&lt;/li&gt;
&lt;li&gt;Examples: Reading scales from different angles&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Systematic errors&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the average / peak is not the true value&lt;/li&gt;
&lt;li&gt;the reading is larger or smaller than (or varying from) the true reading by a constant amount&lt;/li&gt;
&lt;li&gt;can be eliminated by careful calibration&lt;/li&gt;
&lt;li&gt;Examples: Zero Error, Parallax Error&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Precision&lt;/strong&gt; := the range of the values / how close the result is to each other / the size of the smallest division&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;affected by random error&lt;/li&gt;
&lt;li&gt;improve: repeat and average&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Accuracy&lt;/strong&gt; := how close the result is to the true value&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;affected by systematic error&lt;/li&gt;
&lt;li&gt;improve: technique, accurate instrument&lt;/li&gt;
&lt;li&gt;Measured by average&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;Uncertainty Calculation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Absolute Uncertainty (Always 1 s.f. for the final result)&lt;/p&gt;
&lt;p&gt;$y = b \pm c \Rightarrow \Delta y = \Delta b + \Delta c$&lt;/p&gt;
&lt;p&gt;Percentage Uncertainty (1 / 2 s.f.)&lt;/p&gt;
&lt;p&gt;$
\left.
\begin{aligned}
&amp;amp;y=b\cdot c \
&amp;amp;y = \frac{b}{c}
\end{aligned}
\right}
\Rightarrow
\frac{\Delta y}{y} = \frac{\Delta b}{b} + \frac{\Delta c}{c}
$&lt;/p&gt;
&lt;p&gt;$y = a^n \Rightarrow \frac{\Delta y}{y} = n \cdot \frac{\Delta a}{a}$&lt;/p&gt;
&lt;p&gt;When the value times a &lt;em&gt;constant&lt;/em&gt;, the &lt;em&gt;absolute uncertainty&lt;/em&gt; changes but the &lt;em&gt;percentage uncertainty&lt;/em&gt; doesn&apos;t.&lt;/p&gt;
&lt;p&gt;As the s.f. of the absolute uncertainty is always one, the s.f. of the value can therefore be determined.&lt;/p&gt;
&lt;h2&gt;1.4 Scalars and Vectors*&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scalar&lt;/th&gt;
&lt;th&gt;Vector&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;magnitude&lt;/td&gt;
&lt;td&gt;magnitude + direction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Distance, Speed&lt;/td&gt;
&lt;td&gt;Displacement, Velocity&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;You also need to know:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;[x] Vector Addition &amp;amp; Subtraction&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;[x] Represent a vector as two perpendicular components.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Direction : N of E 30° / 30° above x-axis (math)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt; always to include a &lt;em&gt;direction&lt;/em&gt; when the result is a vector.&lt;/p&gt;
&lt;h2&gt;1.? Measurements&lt;/h2&gt;
&lt;h3&gt;Length&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Min / cm&lt;/th&gt;
&lt;th&gt;Max / cm&lt;/th&gt;
&lt;th&gt;Smallest Division / mm&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Measuring Tape&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;150&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Metre Rule&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vernier Caliper&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;0.02&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Micrometer Screw Gauge&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;2.5&lt;/td&gt;
&lt;td&gt;0.01&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Vernier Caliper&lt;/strong&gt;(游标卡尺): main scale + vernier scale&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Micrometer Screw Gauge&lt;/strong&gt;: main scale(0.5) + fractional scale(0.01)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Remember to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;[x] Check zero&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;[x] Repeat &amp;amp; Average&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;[x] Avoid parallax error&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Mass&lt;/h3&gt;
&lt;p&gt;balance&lt;/p&gt;
&lt;h2&gt;1.?? Uncertainties&lt;/h2&gt;
&lt;p&gt;I&apos;ve taken these notes on class but they are neither in the syllabus nor on past papers. Anyway, I put them here.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Uncertainty&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Three main types of uncertainty:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Random Uncertainties&lt;/li&gt;
&lt;li&gt;Systematic Errors&lt;/li&gt;
&lt;li&gt;Reading Uncertainties&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;The Limit of Reading&lt;/strong&gt; of a measurement is equal to the smallest graduation of the scale of an instrument.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Degree of Uncertainty&lt;/strong&gt; of a reading (end reading) is equal to half the smallest graduation of the scale of an instrument.&lt;/p&gt;
&lt;p&gt;Absolute - fractional errors - percentage errors&lt;/p&gt;
&lt;p&gt;1 mm - 1/208 - 0.48%&lt;/p&gt;
</content:encoded></item><item><title>Simulation of Wave Functions in Quantum Mechanics</title><link>https://blog.haoye.plus/posts/qmvis/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/qmvis/</guid><description>Project of Cambridge Summer School</description><pubDate>Sat, 02 Aug 2025 00:00:00 GMT</pubDate><content:encoded>&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#simulation-of-wave-functions-in-quantum-mechanics&quot;&gt;Simulation of Wave Functions in Quantum Mechanics&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#introduction&quot;&gt;Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#simulation-on-1d&quot;&gt;Simulation on 1D&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#initialization&quot;&gt;Initialization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#evolution&quot;&gt;Evolution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#wave-function-representation&quot;&gt;Wave Function Representation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#simulation&quot;&gt;Simulation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#simulation-on-2d&quot;&gt;Simulation on 2D&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#prospect&quot;&gt;Prospect&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#reference&quot;&gt;Reference&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Simulation of Wave Functions in Quantum Mechanics&lt;/h1&gt;
&lt;p&gt;(Cambridge Summer School&apos;s Presentation)&lt;/p&gt;
&lt;p&gt;written in jupyter notebook by Yiran Feng (Leon) 2025-08-02&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Step = QMSim
Step.Gaussian = [-5, 0.5, 4]
Step.Potential = np.array([0] * 120 + [20] * 80)
%manim -qh Step
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;lt;video src=&quot;https://image.haoye.plus/QMVideo/wall.mp4&quot; controls autoplay loop style=&quot;max-width: 100%;&quot;&amp;gt;
Your browser does not support the &amp;lt;code&amp;gt;video&amp;lt;/code&amp;gt; element.
&amp;lt;/video&amp;gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;In chapter 2 and chapter 3, we&apos;ve learnt about wave function in quantum mechanics and its characteristics, however, in a rather mathematical level, with equations and deductions. In this presentation, I&apos;ll present you a python simulation of wave functions in different situations, giving you a intuitive way of understanding quantum mechanics.&lt;/p&gt;
&lt;p&gt;For simplicity, all constants are set to one in this simulation, including mass, planck&apos;s constant, etc.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Libraries
import numpy as np
import scipy as sp
from matplotlib import pyplot as plt
from manim import *
from IPython.display import HTML
from copy import deepcopy as dc
from random import random
import tqdm

# Variables &amp;amp; Constants
inf = 100
x = np.linspace(-10, 10, 200)
y = np.linspace(-10, 10, 200)
X, Y = np.meshgrid(x, y)

# Useful functions
def find_nearest(array, value):
        array = np.asarray(array)
        idx = (np.abs(array - value)).argmin()
        return idx
    
def find_nearest_val(array, value):
        array = np.asarray(array)
        idx = (np.abs(array - value)).argmin()
        return array[idx]
&lt;/code&gt;&lt;/pre&gt;
&lt;hr /&gt;
&lt;h2&gt;Simulation on 1D&lt;/h2&gt;
&lt;p&gt;Basically, the simulation consists of two parts: Initialization and Evolution.&lt;/p&gt;
&lt;h3&gt;Initialization&lt;/h3&gt;
&lt;p&gt;The state of the system can be initialized with two functions: &lt;strong&gt;the initial state of the wave function&lt;/strong&gt; and &lt;strong&gt;the potential function&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;By considering different &lt;strong&gt;initial states&lt;/strong&gt; of the wave function, we can change the position, the spread, and the momentum of the particle.&lt;/p&gt;
&lt;p&gt;By changing the &lt;strong&gt;potential function&lt;/strong&gt;, we can simulate different situations, for example, harmonic oscillator and quantum channel.&lt;/p&gt;
&lt;p&gt;Look into the code. The class &lt;code&gt;Simulation1D&lt;/code&gt; takes in two variables. &lt;code&gt;phi_0&lt;/code&gt; means the initial state of the wave function, and &lt;code&gt;v&lt;/code&gt; defines the potential. The wave function is automatically normalised by the function &lt;code&gt;_normalise&lt;/code&gt;, which is called inside the initialization, and &lt;code&gt;probability&lt;/code&gt;  ( which is basically $|\phi(x)|^2$ ) gives us the probability, of course.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class Simulation1D():
    def __init__(self, phi_0, v):
        self.phi = dc(phi_0); self.v = dc(v)
        self.dx = x[1] - x[0]; self.len = len(phi_0)
        self._normalise(); self._hamiltonian()
        self.prob = []; self.prob_updated = False
        
    def _normalise(self):
        self.phi /= np.linalg.norm(self.phi)
        self.prob_updated = True
        self.prob = (self.phi * self.phi.conjugate()).real
        
    def probability(self, pos = None):
        if not self.prob_updated:
            self._normalise()
        if pos:
            return self.prob[find_nearest(x, pos)]
        else:
            return self.prob
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Evolution&lt;/h3&gt;
&lt;p&gt;From chapter 2 and chapter 3, we&apos;ve learnt that when a system is free from interactions with measuring devices, the evolution of the wave function can be calculated by the &lt;strong&gt;Schrödinger equation&lt;/strong&gt; (44) (Postulate 6)&lt;/p&gt;
&lt;p&gt;$$
i\hbar \frac{\partial ψ(x,t)}{\partial t} = \left [ -\frac{\hbar ^ 2}{2m} \frac{\partial^2}{\partial x^2} + V(x) \right ] ψ(x,t)
$$&lt;/p&gt;
&lt;p&gt;In our cases, the mass and $\hbar$ is set to 1. Introducing the hamiltonian operator $\hat H$, the &lt;strong&gt;1-dimensional time-dependent Schrödinger equation (TDSE)&lt;/strong&gt; can be deduced&lt;/p&gt;
&lt;p&gt;$$
\frac{\partial}{\partial t} ψ(x, t) = -i\hat H ψ(x, t)
$$&lt;/p&gt;
&lt;p&gt;where&lt;/p&gt;
&lt;p&gt;$$
\hat H = -\frac{1}{2} \nabla ^2 + V(x)
$$&lt;/p&gt;
&lt;p&gt;In this equation, the discrete Laplace operator can be given as convolution with &lt;strong&gt;the finite-difference kernel&lt;/strong&gt;, $[1, -2, 1]$, results in a symmetric &lt;strong&gt;Tridiagonal Toeplitz matrix&lt;/strong&gt; with the finite-difference coefficients along the diagonals. Combining this matrix with the potential $V=[V_0, V_1, ..., V_N]$, a full &lt;strong&gt;Hamiltonian operator&lt;/strong&gt; in matrix form can be obtained&lt;/p&gt;
&lt;p&gt;$$
\hat H = -\frac{1}{2\Delta x^2}
\begin{bmatrix}
-2 &amp;amp; 1 &amp;amp; \quad &amp;amp; \quad &amp;amp; \quad \
1 &amp;amp; -2 &amp;amp; 1 &amp;amp; \quad &amp;amp; \quad \
\quad &amp;amp; \quad &amp;amp; \ddots &amp;amp; \quad &amp;amp; \quad \
\quad &amp;amp; \quad &amp;amp; 1 &amp;amp; -2 &amp;amp; 1 \
\quad &amp;amp; \quad &amp;amp; \quad &amp;amp; 1 &amp;amp; -2 \
\end{bmatrix}
+
\begin{bmatrix}
V_0 &amp;amp; \quad &amp;amp; \quad &amp;amp; \quad &amp;amp; \quad \
\quad &amp;amp; V_1 &amp;amp; \quad &amp;amp; \quad &amp;amp; \quad \
\quad &amp;amp; \quad &amp;amp; \ddots &amp;amp; \quad &amp;amp; \quad \
\quad &amp;amp; \quad &amp;amp; \quad &amp;amp; V_{N-1} &amp;amp; \quad \
\quad &amp;amp; \quad &amp;amp; \quad &amp;amp; \quad &amp;amp; V_N \
\end{bmatrix}
$$&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;def _hamiltonian(self):
    &quot;&quot;&quot;Returns Hamiltonian using finite differences.&quot;&quot;&quot;
    L = [[0 for j in range(self.len)] for i in range(self.len)]
    for i in range(self.len):
        for j in range(self.len):
            if i == j:
                L[i][j] = -2
            if abs(i-j) == 1:
                L[i][j] = 1
    
    # Somehow it doesn&apos;t work...
    # L = sp.sparse.diags([1, -2, 1], offsets=[-1, 0, 1], shape=(self.len, self.len))
    
    L = np.array(L) / self.dx ** 2
    H = -L / 2 + sp.sparse.spdiags(self.v, 0, self.len, self.len)
    self.H = sp.sparse.csc_matrix(H)
    
Simulation1D._hamiltonian = _hamiltonian
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the Hamiltonian is independent of time, a &lt;strong&gt;time evolution operator&lt;/strong&gt;(U) can be obtainted&lt;/p&gt;
&lt;p&gt;$$
ψ(t+\delta t) = Uψ(t)
$$&lt;/p&gt;
&lt;p&gt;where&lt;/p&gt;
&lt;p&gt;$$
U = e^{-i\hat H \delta t}
$$&lt;/p&gt;
&lt;p&gt;Multiplying the wave function with the operator $m$ times, we can advance the time steps to $t + m\delta t$&lt;/p&gt;
&lt;p&gt;$$
ψ(t+m\delta t) = U^mψ(t)
$$&lt;/p&gt;
&lt;p&gt;The code below calculates the time evolution operator based on the hamiltonian and &lt;code&gt;dt&lt;/code&gt;, and applies the operator to the wave function, which is also normalized after the procedure.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;def simulate(self, dt = 1e-3):
    &quot;&quot;&quot;Generates wavefunction and time at the next time step.&quot;&quot;&quot;
    U = sp.sparse.linalg.expm(-1j * self.H * dt)
    #U[1E-10 &amp;gt; (U.real**2 + U.imag**2)] = 0
    self.phi = U @ self.phi
    self.phi[self.v &amp;gt; inf-1] = 0
    self._normalise()
    
Simulation1D.simulate = simulate
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Wave Function Representation&lt;/h3&gt;
&lt;p&gt;We use a localized Gaussian wave packet centred at $x_0$ with average initial momentum, $p_0$ , and Gaussian width, $\sigma_0$ . The wave function is given by&lt;/p&gt;
&lt;p&gt;$$
ψ(x, 0) = \left ( \frac{1}{2 \pi \sigma_0^2 } \right ) ^ \frac{1}{4} \mathrm {exp} \left ( -\frac{(x-x_0)^2}{4\sigma_0^2} + i p_0 x\right )
$$&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;def gaussian_wavepacket(x0, sigma, p0):
    &quot;&quot;&quot;Gaussian wavepacket at x0 +/- sigma, with average momentum, p0.&quot;&quot;&quot;
    global x
    return np.exp(1j*p0*x - ((x - x0)/(2 * sigma))**2)
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Simulation&lt;/h3&gt;
&lt;p&gt;After the calculations, some simulations can be done.&lt;/p&gt;
&lt;p&gt;The class &lt;code&gt;QSim&lt;/code&gt; takes in the parameters of the gaussian wavepacket and the potential function. It produces an animation of the evolution of the wave function in 2 seconds using &lt;code&gt;manim&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class QMSim(Scene):
    def construct(self):
        phi_0 = gaussian_wavepacket(self.Gaussian[0], self.Gaussian[1], self.Gaussian[2])
        V = self.Potential
        o = Simulation1D(phi_0, V)
        
        axes = Axes(
            x_range=[-10, 10, 1],
            y_range=[0, 0.17, 1],
            x_length=10,
            axis_config={&quot;color&quot;: GREEN},
            x_axis_config={
                &quot;numbers_to_include&quot;: np.arange(-10, 10.01, 2),
                &quot;numbers_with_elongated_ticks&quot;: np.arange(-10, 10.01, 2),
            },
            tips=True,
        )
        
        axes_labels = axes.get_axis_labels()
        axes_ref = axes.copy()
        
        pot_graph = axes.plot((lambda k: (V/100)[find_nearest(x,k)]), color=BLUE)
        pot_label = axes.get_graph_label(
            pot_graph, &quot;V(x)&quot;, x_val=10, direction=UP / 2
        )
        
        prob_graph = axes.plot(o.probability, color=ORANGE)
        prob_label = axes.get_graph_label(
            prob_graph, r&quot;|\phi(x)|^2&quot;, x_val=-10, direction=UP / 2
        )

        plot = VGroup(axes, pot_graph, prob_graph)
        labels = VGroup(axes_labels, prob_label, pot_label)

        def prob_updater(mobj, dt):
            o.simulate(dt=dt*2)
            mobj.become(axes.plot(o.probability, color=ORANGE))
            return mobj
            

        prob_graph.add_updater(prob_updater)
        prob_label.add_updater(lambda x:x.become(axes.get_graph_label(prob_graph, r&quot;|\phi(x)|^2&quot;, x_val=-10, direction=UP / 2)))
        self.add(plot, labels)
        self.wait(2 + random()) # force update
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Harmonic Oscillator&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Oscillator = QMSim
Oscillator.Gaussian = [-5, 0.5, 0.1]
Oscillator.Potential = x*x
%manim -qh Oscillator
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;lt;video src=&quot;https://image.haoye.plus/QMVideo/oscillator.mp4&quot; controls autoplay loop style=&quot;max-width: 100%;&quot;&amp;gt;
Your browser does not support the &amp;lt;code&amp;gt;video&amp;lt;/code&amp;gt; element.
&amp;lt;/video&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Potential Step&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Step = QMSim
Step.Gaussian = [-5, 0.5, 4]
Step.Potential = np.array([0] * 140 + [7] * 60)
%manim -qh Step
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;lt;video src=&quot;https://image.haoye.plus/QMVideo/step.mp4&quot; controls autoplay loop style=&quot;max-width: 100%;&quot;&amp;gt;
Your browser does not support the &amp;lt;code&amp;gt;video&amp;lt;/code&amp;gt; element.
&amp;lt;/video&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Quantum Channel&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Channel = QMSim
Channel.Gaussian = [-5, 0.5, 4]
Channel.Potential = np.array([0] * 100 + [6] * 10 + [0] * 90)
%manim -qh Channel
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;lt;video src=&quot;https://image.haoye.plus/QMVideo/channel.mp4&quot; controls autoplay loop style=&quot;max-width: 100%;&quot;&amp;gt;
Your browser does not support the &amp;lt;code&amp;gt;video&amp;lt;/code&amp;gt; element.
&amp;lt;/video&amp;gt;&lt;/p&gt;
&lt;p&gt;The real and imagery part of the wave function can also be illustrated&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class QMSim2(Scene):
    def construct(self):
        phi_0 = gaussian_wavepacket(-5, 0.4, 1.4)
        V = np.array([0] * 200)
        o = Simulation1D(phi_0, V)
        
        axes = Axes(
            x_range=[-10, 10, 1],
            y_range=[-0.3, 0.3, 1],
            x_length=10,
            axis_config={&quot;color&quot;: GREEN},
            x_axis_config={
                &quot;numbers_to_include&quot;: np.arange(-10, 10.01, 2),
                &quot;numbers_with_elongated_ticks&quot;: np.arange(-10, 10.01, 2),
            },
            tips=True,
        )
        
        axes_labels = axes.get_axis_labels()
        axes_ref = axes.copy()
        
        real_graph = axes.plot(lambda x:find_nearest_val(o.phi.real,x), color=BLUE)
        real_label = axes.get_graph_label(
            real_graph, r&quot;Re{\phi(x)}&quot;, x_val=-10, direction=UP / 2
        )
        
        imag_graph = axes.plot(lambda x:find_nearest_val(o.phi.imag,x), color=YELLOW)
        imag_label = axes.get_graph_label(
            imag_graph, r&quot;Im{\phi(x)}&quot;, x_val=10, direction=UP / 2
        )

        plot = VGroup(axes, real_graph, imag_graph)
        labels = VGroup(axes_labels, real_label, imag_label)

        def real_updater(mobj, dt):
            o.simulate(dt=dt*2)
            mobj.become(axes.plot(lambda k:(o.phi.real)[find_nearest(x,k)], color=BLUE))
            return mobj

        def imag_updater(mobj, dt):
            mobj.become(axes.plot(lambda k:(o.phi.imag)[find_nearest(x,k)], color=YELLOW))
            return mobj
            

        real_graph.add_updater(real_updater)
        imag_graph.add_updater(imag_updater)
        real_label.add_updater(lambda x:x.become(axes.get_graph_label(real_graph, r&quot;Re{\phi(x)}&quot;, x_val=-10, direction=UP / 2)))
        imag_label.add_updater(lambda x:x.become(axes.get_graph_label(imag_graph, r&quot;Im{\phi(x)}&quot;, x_val=10, direction=UP / 2)))
        
        self.add(plot, labels)
        self.wait(2 + random()) # force update
        
%manim -qh QMSim2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;lt;video src=&quot;https://image.haoye.plus/QMVideo/realimag.mp4&quot; controls autoplay loop style=&quot;max-width: 100%;&quot;&amp;gt;
Your browser does not support the &amp;lt;code&amp;gt;video&amp;lt;/code&amp;gt; element.
&amp;lt;/video&amp;gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;h2&gt;Simulation on 2D&lt;/h2&gt;
&lt;p&gt;Applying the Schrödinger equation in 2D, we can simulate how a 2D wave function evolves.&lt;/p&gt;
&lt;p&gt;However, the calculation for 2D simulation is too complicated for my laptop to run an animation of it. Hence merely an image of the initial state of a 2D wave function is obtained in a relatively low resolution.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Constants
x = np.linspace(-10, 10, 100)
y = np.linspace(-10, 10, 100)
X, Y = np.meshgrid(x, y)
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;class Simulation2D(): # For simplicity, some code&apos;s folded up
    def __init__(self, phi_0, v):
        self.phi = dc(phi_0); self.v = dc(v)
        self.dx = x[1] - x[0]; self.dy = y[1] - y[0]
        self.lenx = len(phi_0[0]); self.leny = len(phi_0)
        self._normalise(); self._hamiltonian()
        
    def _normalise(self):
        self.phi /= np.linalg.norm(self.phi)

    def _hamiltonian(self):
        &quot;&quot;&quot;Returns Hamiltonian using finite differences.&quot;&quot;&quot;
        L1 = [[0 for j in range(self.lenx)] for i in range(self.lenx)]
        for i in range(self.lenx):
            for j in range(self.lenx):
                if i == j:
                    L1[i][j] = -2
                if abs(i-j) == 1:
                    L1[i][j] = 1
                    
        L2 = [[0 for j in range(self.leny)] for i in range(self.leny)]
        for i in range(self.leny):
            for j in range(self.leny):
                if i == j:
                    L2[i][j] = -2
                if abs(i-j) == 1:
                    L2[i][j] = 1

        # 2D Laplacian using Kronecker products
        L1 = np.array(L1) / self.dx ** 2; L2 = np.array(L2) / self.dy ** 2
        I_x = sp.sparse.identity(self.lenx); I_y = sp.sparse.identity(self.leny)
        L2D = sp.sparse.kron(I_y, L1) + sp.sparse.kron(L2, I_x)
        H = (-L2D / 2).toarray()
        for i in range(len(self.v)): # Somehow sp.sparse.diags doesn&apos;t work qaq
            H[i+i*self.lenx] = self.v[i//self.lenx][i%self.lenx]
            
        self.H = sp.sparse.csr_matrix(H)
        
    def simulate(self, dt = 1e-3):
        &quot;&quot;&quot;Generates wavefunction and time at the next time step.&quot;&quot;&quot;
        U = sp.linalg.expm(-1j * self.H.toarray() * dt)
        U[(U.real**2 + U.imag**2) &amp;lt; 1E-10] = 0
        phi_flat = self.phi.flatten()
        phi_flat = U @ phi_flat
        self.phi = phi_flat.reshape((self.lenx, self.leny))
        self.phi[self.v &amp;gt; inf-1] = 0

    def probability(self):
        return (self.phi * self.phi.conjugate()).real
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;def gaussian_wavepacket_2D(x0, y0, sigma, p0):
    &quot;&quot;&quot;Gaussian wavepacket at x0 +/- sigma, y0 +/- sigma with average momentum, p0.&quot;&quot;&quot;
    global x, y
    return np.exp(1j*p0*x - (((X - x0)**2+(Y - y0)**2)/(2 * sigma**2)))
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;def Free2D():
    phi_0 = gaussian_wavepacket_2D(3, 0, 0.5, -1)
    V = X*X+Y*Y
    o = Simulation2D(phi_0, V)
    for i in tqdm.trange(0):
        o.simulate(0.5)

    from matplotlib import cm
    from matplotlib.ticker import LinearLocator
    
    fig, ax = plt.subplots(subplot_kw={&quot;projection&quot;: &quot;3d&quot;})
    
    
    # Plot the surface.
    surf = ax.plot_surface(X, Y, o.probability(), cmap=cm.coolwarm,
                           linewidth=0, antialiased=False)
    
    # Customize the z axis.
    #ax.set_zlim(-1.01, 1.01)
    ax.zaxis.set_major_locator(LinearLocator(10))
    # A StrMethodFormatter is used automatically
    ax.zaxis.set_major_formatter(&apos;{x:.02f}&apos;)
    
    # Add a color bar which maps values to colors.
    fig.colorbar(surf, shrink=0.5, aspect=5)
    
    plt.show()
    
Free2D()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/QMVideo/2D.png&quot; alt=&quot;png&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Prospect&lt;/h2&gt;
&lt;p&gt;Some improvements could also be made regarding this simulation and animation ...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Record physical quantities (momentum, energy, ...) during the simulation&lt;/li&gt;
&lt;li&gt;Increase the resolution for a higher accuracy&lt;/li&gt;
&lt;li&gt;Complete simulations in 2D&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks for listening ~&lt;/p&gt;
&lt;h2&gt;Reference&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;https://www.astro.utoronto.ca/~mahajan/notebooks/quantum_tunnelling.html&lt;/p&gt;
&lt;p&gt;https://docs.manim.community/&lt;/p&gt;
&lt;/blockquote&gt;
</content:encoded></item><item><title>IG Maths(Extended) 复习笔记</title><link>https://blog.haoye.plus/posts/ig_math/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/ig_math/</guid><description>IGCSE数学复习笔记</description><pubDate>Tue, 16 Apr 2024 00:00:00 GMT</pubDate><content:encoded>&lt;blockquote&gt;
&lt;p&gt;This note might not cover everything.&lt;/p&gt;
&lt;p&gt;（有些很简单的我就没记，最好考前看一眼syllabus: &lt;a href=&quot;https://www.cambridgeinternational.org/programmes-and-qualifications/cambridge-upper-secondary/cambridge-igcse/subjects/&quot;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;有任何错误/补充欢迎评论指正ouo&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#number&quot;&gt;Number&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%95%B0&quot;&gt;数&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E9%9B%86%E5%90%88&quot;&gt;集合&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E8%B4%A8%E5%9B%A0%E6%95%B0-%E4%B8%8E%E6%9C%80%E5%A4%A7%E5%85%AC%E5%9B%A0%E6%95%B0%E6%9C%80%E5%B0%8F%E5%85%AC%E5%80%8D%E6%95%B0&quot;&gt;质因数 (与最大公因数最小公倍数)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%8C%87%E6%95%B0%E8%BF%90%E7%AE%97%E7%A7%91%E5%AD%A6%E8%A1%A8%E8%BE%BE%E5%BC%8F&quot;&gt;指数运算&amp;amp;科学表达式&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%88%86%E6%95%B0&quot;&gt;分数&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%AF%94%E4%BE%8B&quot;&gt;比例&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%88%A9%E6%81%AF&quot;&gt;利息&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#fdp&quot;&gt;FDP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#ratio&quot;&gt;Ratio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#compound-measures&quot;&gt;Compound Measures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%97%B6%E9%97%B4-%E8%B4%A7%E5%B8%81-%E8%BD%AC%E6%8D%A2&quot;&gt;时间 货币 转换&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E8%BF%91%E4%BC%BC-%E4%BC%B0%E8%AE%A1-%E8%BE%B9%E7%95%8C&quot;&gt;近似 估计 边界&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E8%AE%A1%E7%AE%97%E5%99%A8&quot;&gt;计算器&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#algebra--graphs&quot;&gt;Algebra &amp;amp; Graphs&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%9F%BA%E7%A1%80&quot;&gt;基础&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%8C%87%E6%95%B0%E6%A0%B9%E5%8F%B7&quot;&gt;指数根号&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%B1%95%E5%BC%80%E6%8B%AC%E5%8F%B7%E5%9B%A0%E5%BC%8F%E5%88%86%E8%A7%A3&quot;&gt;展开括号，因式分解&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E7%BA%BF%E6%80%A7%E6%96%B9%E7%A8%8B%E4%B8%8D%E7%AD%89%E5%BC%8F&quot;&gt;线性方程，不等式&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BA%8C%E6%AC%A1%E6%96%B9%E7%A8%8B&quot;&gt;二次方程&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E9%87%8D%E6%95%B4%E5%BC%8F%E5%AD%90&quot;&gt;重整式子&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E8%81%94%E7%AB%8B%E6%96%B9%E7%A8%8B&quot;&gt;联立方程&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%88%86%E5%BC%8F&quot;&gt;分式&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%88%97%E6%96%B9%E7%A8%8B%E8%A7%A3%E6%96%B9%E7%A8%8B&quot;&gt;列方程解方程&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%87%BD%E6%95%B0&quot;&gt;函数&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%95%B0%E5%88%97&quot;&gt;数列&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%9D%90%E6%A0%87%E7%B3%BB&quot;&gt;坐标系&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E7%BA%BF%E5%9E%8B%E5%9B%BE%E8%B1%A1&quot;&gt;线型图象&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BA%8C%E6%AC%A1%E5%9B%BE%E5%83%8F&quot;&gt;二次图像&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%9B%B4%E5%A4%9A%E5%9B%BE%E5%83%8F%E5%92%8C%E5%88%87%E7%BA%BF&quot;&gt;更多图像和切线&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E8%A7%A3%E4%B8%8D%E7%AD%89%E5%BC%8F&quot;&gt;解不等式&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E7%94%9F%E6%B4%BB%E4%B8%AD%E7%9A%84%E5%9B%BE%E5%83%8F&quot;&gt;生活中的图像&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%BE%AE%E5%88%86&quot;&gt;微分&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#geometry&quot;&gt;Geometry&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%9F%BA%E6%9C%AC&quot;&gt;基本&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%A4%9A%E8%BE%B9%E5%BD%A2%E5%92%8C%E5%B9%B3%E8%A1%8C%E7%BA%BF%E9%87%8C%E7%9A%84%E8%A7%92&quot;&gt;多边形和平行线里的角&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#bearings-constructions--scale-drawings&quot;&gt;bearings constructions &amp;amp; scale drawings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%9C%86&quot;&gt;圆&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E9%9D%A2%E7%A7%AF%E5%92%8C%E5%91%A8%E9%95%BF&quot;&gt;面积和周长&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%9C%86%E5%92%8C%E6%89%87%E5%BD%A2%E5%92%8C%E5%BC%A7&quot;&gt;圆和扇形和弧&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BD%93%E7%A7%AF%E5%92%8C%E8%A1%A8%E9%9D%A2%E7%A7%AF&quot;&gt;体积和表面积&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%85%A8%E7%AD%89%E5%92%8C%E7%9B%B8%E4%BC%BCcongruence--similarity&quot;&gt;全等和相似(congruence &amp;amp; similarity)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E7%9B%B4%E8%A7%92%E4%B8%89%E8%A7%92%E5%BD%A2&quot;&gt;直角三角形&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#sine-cosine-rule--%E4%B8%89%E8%A7%92%E5%BD%A2%E9%9D%A2%E7%A7%AF&quot;&gt;sine, cosine rule &amp;amp; 三角形面积&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%B8%89%E7%BB%B4%E4%B8%89%E8%A7%92%E5%87%BD%E6%95%B0&quot;&gt;三维三角函数&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%B8%89%E8%A7%92%E5%87%BD%E6%95%B0%E5%9B%BE%E5%83%8F%E5%92%8C%E6%96%B9%E7%A8%8B&quot;&gt;三角函数图像和方程&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%90%91%E9%87%8F&quot;&gt;向量&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%8F%98%E5%8C%96&quot;&gt;变化&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#probability--statistics&quot;&gt;Probability &amp;amp; Statistics&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%9F%BA%E7%A1%80-1&quot;&gt;基础&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%A6%82%E7%8E%87%E5%9B%BE%E5%83%8F&quot;&gt;概率图像&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#conditional-probability&quot;&gt;conditional probability&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%B9%B3%E5%9D%87%E5%92%8C%E6%9E%81%E5%B7%AE&quot;&gt;平均和极差&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E7%BB%9F%E8%AE%A1%E5%9B%BE%E5%83%8F&quot;&gt;统计图像&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#histogram%E7%9B%B4%E6%96%B9%E5%9B%BE&quot;&gt;Histogram(直方图)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#cumulative-frequency--box-plots&quot;&gt;cumulative frequency &amp;amp; box plots&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#scatter-graphs--correlation&quot;&gt;scatter graphs &amp;amp; correlation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#some-own-experience&quot;&gt;Some own experience&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Number&lt;/h1&gt;
&lt;h2&gt;数&lt;/h2&gt;
&lt;p&gt;Real Numbers(ℝ):实数
Integers(Whole Numbers)(ℤ):整数
Natural numbers(ℕ):自然数(不包括0？查一下syllabus)
正整数(N+)(N*)
Rational Numbers(Q):有理数
A factor: 因数
A multiple:倍数
index/order/exponents:指数
reciprocal:倒数&lt;/p&gt;
&lt;p&gt;quotient:商
Approximately equal to:约等于
identical to:全等于
bracket:括号
竖式
乘法
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2020/03/Lattice-Ex1.png&quot; alt=&quot;multiply&quot; /&gt;
除法
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2020/03/Bus-Stop-Completed-Example.png&quot; alt=&quot;division&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;集合&lt;/h2&gt;
&lt;p&gt;{(x, y) : y = 2x + 1}&lt;/p&gt;
&lt;p&gt;E:universal set&lt;/p&gt;
&lt;p&gt;∅:empty set&lt;/p&gt;
&lt;p&gt;n(∅) = 0&lt;/p&gt;
&lt;p&gt;upper case: set , lower case: element&lt;/p&gt;
&lt;p&gt;a ∈ A means a is an element of A&lt;/p&gt;
&lt;p&gt;A ⊆ B means A is a subset of B&lt;/p&gt;
&lt;p&gt;A ⊂ B means A is a proper subset of B (A≠B)&lt;/p&gt;
&lt;p&gt;A∩B intersection
A∪B union
A&apos; not A&lt;/p&gt;
&lt;h2&gt;质因数 (与最大公因数最小公倍数)&lt;/h2&gt;
&lt;p&gt;Prime tree
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2020/03/Factor-Tree-360.png&quot; alt=&quot;prime_tree&quot; /&gt;
prime factor decomposition (PFD)
indices are even: square number
indices are multiples of 3: cube number
the highest common factor (HCF)最大公因数
the lowest common multiple (LCM)最小公倍数
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2020/03/Venn-Diagram-42-90.png&quot; alt=&quot;HCF/LCM&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;指数运算&amp;amp;科学表达式&lt;/h2&gt;
&lt;p&gt;base number: 底数
index: 指数&lt;/p&gt;
&lt;p&gt;square root:平方根
cube root:立方根
A nth root
standard form: 科学表达式&lt;/p&gt;
&lt;h2&gt;分数&lt;/h2&gt;
&lt;p&gt;numerator: 分子
denominator: 分母
mixed numbers: 带分数
improper fraction(top heavy fraction): 假分数&lt;/p&gt;
&lt;h2&gt;比例&lt;/h2&gt;
&lt;p&gt;A multiplier, p, is the decimal equivalent of a percentage increase or decrease&lt;/p&gt;
&lt;h2&gt;利息&lt;/h2&gt;
&lt;p&gt;simple interest: 单利
compound interest: 复利
depreciation: 约等于复利
substitute: 代入
decay: 下降&lt;/p&gt;
&lt;h2&gt;FDP&lt;/h2&gt;
&lt;p&gt;terminating decimal: 有限小数
recurring decimal: 无限循环小数
错位相减&lt;/p&gt;
&lt;h2&gt;Ratio&lt;/h2&gt;
&lt;p&gt;direct proportion: 正比
inverse proportion: 反比&lt;/p&gt;
&lt;h2&gt;Compound Measures&lt;/h2&gt;
&lt;p&gt;没啥好说的&lt;/p&gt;
&lt;h2&gt;时间 货币 转换&lt;/h2&gt;
&lt;p&gt;millennium: 千年
midday: 12pm
midnight: 12am
am/pm : 12 1 2 3 4 5 6 7 8 9 10 11&lt;/p&gt;
&lt;p&gt;Each column represents a different bus/train – these are often called “services”&lt;/p&gt;
&lt;p&gt;The time in each cell usually indicate departure times(when the bus/train leaves that stop/station)&lt;/p&gt;
&lt;p&gt;The last location on the list usually shows the arrival time&lt;/p&gt;
&lt;p&gt;GBP: 英镑£&lt;/p&gt;
&lt;p&gt;汇率类问题单独开一行写A货币比B货币等于几比几，下面一行写x:几几几。再用除法算出scale factor&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;钱要保留两位小数！！！！&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;近似 估计 边界&lt;/h2&gt;
&lt;p&gt;estimate: 一般一个sf&lt;/p&gt;
&lt;p&gt;LB &amp;lt;= x &amp;lt; UB&lt;/p&gt;
&lt;p&gt;计算：x+-一半精度&lt;/p&gt;
&lt;h2&gt;计算器&lt;/h2&gt;
&lt;p&gt;负数：(-)
rounding 不必在计算中进行，用3.1415...省略号表示&lt;/p&gt;
&lt;h1&gt;Algebra &amp;amp; Graphs&lt;/h1&gt;
&lt;h2&gt;基础&lt;/h2&gt;
&lt;p&gt;term: 单项式
coefficient: 系数
constants: 常数
expression: 表达式
equation: 方程/等式
formula: 公式(F=ma)
inequality: 不等式
substitution: 代入
v=u+at
v2-u2=2as
s=ut+0.5at2
&quot;like&quot; terms: 同类项&lt;/p&gt;
&lt;p&gt;a^x=a^y
x=y&lt;/p&gt;
&lt;h2&gt;指数根号&lt;/h2&gt;
&lt;h2&gt;展开括号，因式分解&lt;/h2&gt;
&lt;p&gt;expanding: 展开
factorisation: 因式分解
quadratic expression: 二次表达式
monic quadratic expression: a=1
non-monic : a!=1
十字相乘
discriminant: 判别式(b2-4ac)&lt;/p&gt;
&lt;h2&gt;线性方程，不等式&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920,w=1280/uploads/2022/11/2-18-solving-inequalities.png&quot; alt=&quot;number line&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;二次方程&lt;/h2&gt;
&lt;p&gt;completing the square: a(x+p)2+q
quadratic formula: 二次方程求根公式
repeated root: 两个相同的根&lt;/p&gt;
&lt;h2&gt;重整式子&lt;/h2&gt;
&lt;p&gt;(rearrange formulae)
(changing the subject)&lt;/p&gt;
&lt;h2&gt;联立方程&lt;/h2&gt;
&lt;p&gt;linear simultaneous equations: 线性方程组
Elimination: 加减消元
substitution: 代入&lt;/p&gt;
&lt;h2&gt;分式&lt;/h2&gt;
&lt;p&gt;分式: Algebraic Fractions&lt;/p&gt;
&lt;h2&gt;列方程解方程&lt;/h2&gt;
&lt;p&gt;5 lots of something: 5x
polygon: 多边形
parallelogram: 平行四边形
rhombus: 菱形
prisms: 柱体
pyramids: 锥体
regular polygon: 正多边形
interpret: 解释&lt;/p&gt;
&lt;h2&gt;函数&lt;/h2&gt;
&lt;p&gt;Composite(compound) functions: 复合函数
Inverse Functions: 反函数&lt;/p&gt;
&lt;h2&gt;数列&lt;/h2&gt;
&lt;p&gt;Sequences: 数列
term: 项
position: 索引(ish?)
position-to-term rule: 通项公式
term-to-term rule: 由an前面的项得到an
linear(arithmetic)/quadratic(二次序列)/geometric(等比序列) sequences
cubic sequence: the third differences are constant
common ratio: 公比
common difference: 公差&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;a&lt;/strong&gt; fibonacci sequence: 泛指an=a(n-1)+a(n-2)的序列，可以改变前两项
&lt;strong&gt;the&lt;/strong&gt; fibonacci sequence: 前两项为1&lt;/p&gt;
&lt;p&gt;求quadratic sequence的a: the second difference 除以二
剩下的用原数列减an2,得到一个等差数列&lt;/p&gt;
&lt;h2&gt;坐标系&lt;/h2&gt;
&lt;p&gt;steep: 陡峭的
求斜率：rise over run
Pythagoras’ Theorem: 勾股定理&lt;/p&gt;
&lt;h2&gt;线型图象&lt;/h2&gt;
&lt;p&gt;ax+by+c=0 -&amp;gt; 斜率: -a/b 截距: -c/b
parallel: 平行(相同的直线不是平行)
the negative reciprocal: 倒数取反&lt;/p&gt;
&lt;h2&gt;二次图像&lt;/h2&gt;
&lt;p&gt;parabola: 抛物线&lt;/p&gt;
&lt;h2&gt;更多图像和切线&lt;/h2&gt;
&lt;h2&gt;解不等式&lt;/h2&gt;
&lt;p&gt;有等号的用实线，否则用虚线
要shade unwanted的area&lt;/p&gt;
&lt;h2&gt;生活中的图像&lt;/h2&gt;
&lt;p&gt;conversion/convert: 转换
deceleration: 减速&lt;/p&gt;
&lt;h2&gt;微分&lt;/h2&gt;
&lt;p&gt;the derivative: 导数
the derived function: 导函数
f&apos;(x) -&amp;gt; f-dashed-of-x
Turning points/stationary points: 导数为0的点
peak/trough: 峰/谷
positive cubic: 左边最大值，右边最小值
negative cubic: 左边最小值，右边最大值
d2y/dx2
optimisation/optimal: 优化&lt;/p&gt;
&lt;h1&gt;Geometry&lt;/h1&gt;
&lt;h2&gt;基本&lt;/h2&gt;
&lt;p&gt;symmetry: 对称
the order of rotational symmetry: 转一圈有几次和自己一样
(有的时候order是1也会说成没有rotational symmetry)
n lines of symmetry(有n条对称轴)
mirror line
polygon: 多边形
cuboid: 长方体
cylinder: 圆柱&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;triangle&lt;/li&gt;
&lt;li&gt;quadrilateral&lt;/li&gt;
&lt;li&gt;pentagon&lt;/li&gt;
&lt;li&gt;hexagon&lt;/li&gt;
&lt;li&gt;heptagon&lt;/li&gt;
&lt;li&gt;octagon&lt;/li&gt;
&lt;li&gt;nonagon&lt;/li&gt;
&lt;li&gt;decagon&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;cube: 9 planes of symmetry
一般来说，柱体的planes of symmetry是横截面的对称轴数量加1
而锥体的是横截面对称轴数量
equilateral triangle: 等边三角形
isosceles triangle: 等腰三角形
parallelograms: 平行四边形
rhombuses(rhombi): 菱形
trapezium: 梯形（一对边平行）
kite: 两组邻边相等的四边形
bisect: 平分
obtuse angle: 钝角
acute angle: 锐角
dagonal: 对角线
perimeter: 周长
circumference: 圆的周长
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920,w=1280/uploads/2020/03/Parts-of-a-circle.png&quot; alt=&quot;circle&quot; /&gt;&lt;/p&gt;
&lt;p&gt;prism: 柱体
pyramid: 锥体
square-based pyramid
cone: circular base
tetrahedron: base is an equilateral triangle&lt;/p&gt;
&lt;p&gt;face/vertex(vertices)/edge&lt;/p&gt;
&lt;p&gt;net: 展开图&lt;/p&gt;
&lt;p&gt;1cl = 10 ml&lt;/p&gt;
&lt;p&gt;1 hectare (ha) = 10 000 m2&lt;/p&gt;
&lt;h2&gt;多边形和平行线里的角&lt;/h2&gt;
&lt;p&gt;basic angle properties:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Angles that meet at a point add up to 360°&lt;/li&gt;
&lt;li&gt;Angles that meet at a point on a straight line add up to 180°&lt;/li&gt;
&lt;li&gt;Vertically opposite angles are equal(对顶角相等)
regular polygon: 正多边形&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;sum of interior angles = 180° × (n-2)
外角(exterior angle)和永远为360°&lt;/p&gt;
&lt;p&gt;Corresponding angles are equal(同位角相等)
Alternate angles are equal(内错角相等)
Allied (co-interior) angles add to 180°(同旁内角互补)
(on parallel lines)&lt;/p&gt;
&lt;p&gt;transverse: 跨过两个平行线的直线&lt;/p&gt;
&lt;h2&gt;bearings constructions &amp;amp; scale drawings&lt;/h2&gt;
&lt;p&gt;bearing: 从北方开始顺时针测量，保留三位有效数字，不写degree symbol
(画图记得画north line)
面积用A(Area)&lt;/p&gt;
&lt;h2&gt;圆&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;所有的circle theorem在考试中都要写出来&lt;/strong&gt;
Circle Theorem: The angle subtended by an arc at the centre is twice the angle at the circumference(这个定理必须写出来)
Circle Theorem: The angle in a semicircle is a right angle(俺也一样)&lt;/p&gt;
&lt;p&gt;chord(弦)
Any equal chords are equidistant from the centre of the circle
Circle Theorem: The perpendicular bisector of a chord is a radius
Circle Theorem: A radius and a tangent meet at right angles
Two tangents from a circle to the same point outside of a circle are equal&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;cyclic quadrilaterals&lt;/strong&gt;(圆内接四边形)
Circle theorem: Opposite angles in a cyclic quadrilateral add up to 180°&lt;/p&gt;
&lt;p&gt;Circle Theorem: Angles at the circumference subtended by the same arc are equal(Angles in the same segment are equal)
Circle Theorem: Alternate Segment Theorem(弦切角定理)
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1920,f=auto/uploads/2020/03/Alternate-Segment-Theorem.png&quot; alt=&quot;circle theorem&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;面积和周长&lt;/h2&gt;
&lt;p&gt;compound shapes: 由多个简单图形拼接出来的图形
rectangle: A=lw
triangle: A=1/2 bh
trapezium: A=1/2 (a+b)h
parallelogram: A=bh&lt;/p&gt;
&lt;h2&gt;圆和扇形和弧&lt;/h2&gt;
&lt;p&gt;arc:弧
minor arc(劣弧)
major arc(优弧)
sector: 扇形
minor sector
major sector&lt;/p&gt;
&lt;h2&gt;体积和表面积&lt;/h2&gt;
&lt;p&gt;volume: 体积
volume of a pyramid: 三分之一底乘高
圆的体积：4/3 πr3
frustum: 圆台&lt;/p&gt;
&lt;p&gt;surface area: 表面积
slant height: 斜高
surface area of a sphere = 4πr2&lt;/p&gt;
&lt;h2&gt;全等和相似(congruence &amp;amp; similarity)&lt;/h2&gt;
&lt;p&gt;congruent/congruence: 全等
SAS,ASA,AAS,SSS,RHS
similar: 相似
证明任意多边形相似：对应边成比例
三角形：AAA
Equivalent: 对应的&lt;/p&gt;
&lt;h2&gt;直角三角形&lt;/h2&gt;
&lt;p&gt;Pythagoras’ Theorem: 勾股定理
hypotenuse: 斜边
opposite: 对边
Adjacent: 邻边&lt;/p&gt;
&lt;p&gt;Trigonometry: 三角学
sin: 奇函数
cos: 偶函数&lt;/p&gt;
&lt;p&gt;the angles of elevation and depression
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920,w=1280/uploads/2023/06/IV60s58R_ib-ai-sl-3-3-3-applications-of-trigonometry-diagram-1.png&quot; alt=&quot;graph&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;sine, cosine rule &amp;amp; 三角形面积&lt;/h2&gt;
&lt;p&gt;the sine rule: a/sinA = b/sinB = c/sinC
the cosine rule: cosA = (b2+c2-a2) / 2bc
or a2=b2+c2 - 2bc cosA&lt;/p&gt;
&lt;p&gt;A = 1/2 ab sinC
表示角的方法: ABC上面加一个^&lt;/p&gt;
&lt;h2&gt;三维三角函数&lt;/h2&gt;
&lt;p&gt;d2=a2+b2+c2&lt;/p&gt;
&lt;h2&gt;三角函数图像和方程&lt;/h2&gt;
&lt;p&gt;先label出关键点，再连接成线
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920,w=1280/uploads/2022/10/cie-igcse-3-12-2-solving-trig-equations-4.png&quot; alt=&quot;graph&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;向量&lt;/h2&gt;
&lt;p&gt;magnitude direction
translation vector
scalar: 标量
magnitude(modulus): |&lt;strong&gt;a&lt;/strong&gt;|
specific vector: AB-&amp;gt;
general vector: &lt;strong&gt;a&lt;/strong&gt;
证明三点共线：找出两个向量平行&lt;/p&gt;
&lt;h2&gt;变化&lt;/h2&gt;
&lt;p&gt;original shape: object(A,B,C)
transformed shape: image(A&apos;,B&apos;,C&apos;)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;translation&lt;/strong&gt;
Shape A has been translated using the vector (一个向量)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;reflection&lt;/strong&gt;
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/w=1280,f=auto/uploads/2020/03/Q1-Reflection-Solution.png&quot; alt=&quot;reflection&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Shape A has been reflected in the line x=-1 to create shape B&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;rotation&lt;/strong&gt;
Rotation, 90o clockwise with centre (-4, 0)
&lt;strong&gt;enlargement&lt;/strong&gt;
The length scale factor is 2, therefore the area scale factor will be 2^2 = 4, hence, the area of C&apos; is 4 times larger than C&lt;/p&gt;
&lt;p&gt;Shape A has been enlarged using a scale factor of 3 and a centre of enlargement (9, 9) to create shape B&lt;/p&gt;
&lt;p&gt;C.o.E&lt;/p&gt;
&lt;p&gt;&lt;s&gt;objection&lt;/s&gt;&lt;/p&gt;
&lt;h1&gt;Probability &amp;amp; Statistics&lt;/h1&gt;
&lt;h2&gt;基础&lt;/h2&gt;
&lt;p&gt;An experiment is a repeatable activity that has a result that can be observed or recorded
Trials are what we call the repeats of the experiment
An outcome is a possible result of a trial
An event is an outcome or a collection of outcomes
A sample space is the set of all possible outcomes of an experiment
The probability of event A is denoted as P(A)&lt;/p&gt;
&lt;p&gt;The complement of event A is the event where event A does not happen
A&apos;
mutually exclusive events: 发生了A就不可能发生B，A交B为空集&lt;/p&gt;
&lt;p&gt;sample space: 所有可能的结果
possibility diagram: combining two things using a grid
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920,w=1280/uploads/2022/12/dice-grid.png&quot; alt=&quot;possibility diagram&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Relative frequency(estimate probabilities from experimental data)&lt;/p&gt;
&lt;p&gt;expected frequency(the number of times you would expect a particular outcome to occur when repeating a trial numerous times)&lt;/p&gt;
&lt;h2&gt;概率图像&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Two Way Tables&lt;/strong&gt;
The row/column totals are sometimes called marginal (or sub-) totals
Where the row totals and column totals meet, we have the grand total
Conditional probabilities are sometimes written using the &apos;straight bar&apos; notation P(A|B)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Venn Diagrams&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Tree Diagrams&lt;/strong&gt;
&lt;img src=&quot;https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1920,w=1280/uploads/2022/05/3-1-3-fig1-tree-setup.png&quot; alt=&quot;tree&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;conditional probability&lt;/h2&gt;
&lt;h2&gt;平均和极差&lt;/h2&gt;
&lt;h2&gt;统计图像&lt;/h2&gt;
&lt;h2&gt;Histogram(直方图)&lt;/h2&gt;
&lt;h2&gt;cumulative frequency &amp;amp; box plots&lt;/h2&gt;
&lt;p&gt;Correlation is a way of describing the way two quantities are related to each other&lt;/p&gt;
&lt;p&gt;positive/negative/no coorelation&lt;/p&gt;
&lt;p&gt;correlation doesn&apos;t mean causation&lt;/p&gt;
&lt;h2&gt;scatter graphs &amp;amp; correlation&lt;/h2&gt;
&lt;h1&gt;Some own experience&lt;/h1&gt;
&lt;p&gt;记得带量角器
多于一分记得写过程
show all your working: 每一步都要写(假分数变带分数的过程也要)
degree 保留一个小数位
有一些题目不需要3sf，直接写出答案
圆切角定理！！！&lt;/p&gt;
&lt;p&gt;Arno buys a student ticket for $43.68 .
This is a saving of 16% on the full price of a ticket.
Calculate the full price of a ticket.&lt;/p&gt;
&lt;p&gt;43.68是减去16%后的价格，并不是那16%&lt;/p&gt;
&lt;p&gt;看清题目要求increase还是自己&lt;/p&gt;
&lt;p&gt;Reference: &lt;a href=&quot;https://www.savemyexams.com/&quot;&gt;savemyexams&lt;/a&gt;&lt;/p&gt;
</content:encoded></item><item><title>AC自动机(Aho-Corasick Algorithm)</title><link>https://blog.haoye.plus/posts/ac/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/ac/</guid><description>AC Algorithm</description><pubDate>Sun, 19 Nov 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;s&gt;自动AC机&lt;/s&gt;&lt;/p&gt;
&lt;p&gt;前置知识：kmp算法&lt;/p&gt;
&lt;p&gt;还没加图片qwq（不过也能看）&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%BC%95%E5%85%A5&quot;&gt;引入&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#trie%E6%A0%91&quot;&gt;Trie树&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#fail%E6%8C%87%E9%92%88&quot;&gt;Fail指针&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#fail-%E6%8C%87%E9%92%88%E4%BC%98%E5%8C%96&quot;&gt;Fail 指针优化&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%9F%A5%E8%AF%A2&quot;&gt;查询&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BB%A3%E7%A0%81%E5%AE%9E%E8%B7%B5&quot;&gt;代码实践&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;引入&lt;/h1&gt;
&lt;p&gt;kmp算法处理了一个模式串在一个文本串中匹配的场景。如果是多个模式串在一个文本串匹配呢？&lt;/p&gt;
&lt;h1&gt;Trie树&lt;/h1&gt;
&lt;p&gt;由于我们在&lt;a href=&quot;https://blog.haoye.plus/post/trie&quot;&gt;上一章&lt;/a&gt;详细讨论了字典树，这章就不做赘述&lt;/p&gt;
&lt;h1&gt;Fail指针&lt;/h1&gt;
&lt;p&gt;如同kmp算法一样，AC自动机高效的原因也是&lt;strong&gt;在失配的时候可以及时调整，避免重复运算&lt;/strong&gt;，用一个 &lt;code&gt;fail&lt;/code&gt; 数组实现这一流程。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;fail[i]&lt;/code&gt; 所储存的值 &lt;code&gt;u&lt;/code&gt; 是存在于字典树中的 &lt;code&gt;i&lt;/code&gt; 的最长后缀。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;fail[i]&lt;/code&gt; 的值可以由比点 &lt;code&gt;i&lt;/code&gt; 辈分还高的点的 &lt;code&gt;fail&lt;/code&gt; 值得到。我们先来看一下过程&lt;/p&gt;
&lt;p&gt;考虑计算 &lt;code&gt;fail[i]&lt;/code&gt; 的值：&lt;/p&gt;
&lt;p&gt;让 &lt;code&gt;u = fa[i]&lt;/code&gt;，也就是i的父节点&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;如果 &lt;code&gt;fail[u]&lt;/code&gt; 的子节点中有 &lt;code&gt;i&lt;/code&gt; 的值，那么 &lt;code&gt;fail[i] = fail[u]的那个子节点&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;如果 &lt;code&gt;fail[u]&lt;/code&gt; 的子节点中没有 &lt;code&gt;i&lt;/code&gt; 的值，那么 &lt;code&gt;u = fail[u]&lt;/code&gt; ，从头继续&lt;/li&gt;
&lt;li&gt;如果 &lt;code&gt;u&lt;/code&gt; 已经是根节点了，那么停止循环， &lt;code&gt;fail[u] = 0&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;为什么这样可行呢？&lt;/p&gt;
&lt;p&gt;因为 &lt;code&gt;i&lt;/code&gt; 的父节点已经帮 &lt;code&gt;i&lt;/code&gt; 找好了 &lt;code&gt;i&lt;/code&gt; 前一个字符串的最长公共后缀的元素在哪里。对于 &lt;code&gt;i&lt;/code&gt; 来说，只要“子承父业”，继承父亲所找到的那个元素就好了，如果“父业”（也就是 &lt;code&gt;fail[fa[i]]&lt;/code&gt; 节点）下有他儿子就好。（对应步骤1）&lt;/p&gt;
&lt;p&gt;如果没有也没关系。继承不了父亲的也可以沿着父亲找到的那个元素的链条往上爬，再往上找，直到找到某个元素使这个元素的子节点下面有 &lt;code&gt;i&lt;/code&gt; 就行。（对应步骤2）如果实在没有直接 &lt;code&gt;fail[i] = 0&lt;/code&gt;（对应步骤3）&lt;/p&gt;
&lt;h1&gt;Fail 指针优化&lt;/h1&gt;
&lt;p&gt;看起来很美好，可是如果一直向上追溯肯定时间不够。&lt;/p&gt;
&lt;p&gt;我们可以给每个元素都加上“虚拟儿子”，凑齐二十六个字母（如果题目有数字那也要包括）。这样子元素就可以直接“子承父业”， &lt;code&gt;fail[i] = fail[fa[i]].son[i对应的字符的值]&lt;/code&gt;（不用上一节一直往上爬（步骤2）了，因为“父业”下面已经有这个儿子了~~（虽然可能是虚拟的）~~）。i的“虚拟儿子” &lt;code&gt;c&lt;/code&gt; （也就是 &lt;code&gt;i&lt;/code&gt; 原本没有 &lt;code&gt;c&lt;/code&gt; 这个儿子）是&lt;code&gt;i.son[c] = fail[i].son[c]&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;前面一句话好理解。那么最后一句话呢？&lt;/p&gt;
&lt;p&gt;其实“虚拟儿子”就保存着我们上一节循环后的答案。这里“真实儿子”对应着步骤1找到了元素，“虚拟儿子”对应着步骤2没找到元素。因为 &lt;code&gt;i&lt;/code&gt; 的虚拟儿子 &lt;code&gt;c&lt;/code&gt; 是由  &lt;code&gt;fail[i]&lt;/code&gt; 的儿子 &lt;code&gt;c&lt;/code&gt; 得到的。如果它是真实的那么最终 &lt;code&gt;i&lt;/code&gt; 的虚拟儿子 &lt;code&gt;c&lt;/code&gt; 就对应着另一个元素 &lt;code&gt;fail[fa[d]] = i,d的值为c&lt;/code&gt; 的 &lt;code&gt;fail[d]&lt;/code&gt; 的值，&lt;code&gt;fail[d] = i.son[c]&lt;/code&gt;。即使它是虚拟的但他也是由&lt;code&gt;fail[fail[i]]&lt;/code&gt; 的儿子 &lt;code&gt;c&lt;/code&gt; 得到的。一直向上，和上一节的循环一样。如果遇到了真实的停，直到根节点。只不过是把这个过程&lt;strong&gt;从上往下&lt;/strong&gt;进行了而已。&lt;/p&gt;
&lt;p&gt;用&lt;strong&gt;BFS&lt;/strong&gt;（广度优先搜索）从上往下更新，可以保证更新一个节点时比它辈分还大的节点已经更新完了。&lt;/p&gt;
&lt;p&gt;引用一句名言&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Talk is cheap. Show me the code.&lt;/p&gt;
&lt;p&gt;​                                               --- Linus&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre&gt;&lt;code&gt;queue&amp;lt;int&amp;gt; que;
void bfs(){
    for(int i=0;i&amp;lt;=25;i++){
        if(tr[0][i])que.push(tr[0][i]);
    }
    while(!que.empty()){
        int u=que.front();
        que.pop();
        for(int i=0;i&amp;lt;=25;i++){
            if(!tr[u][i])   tr[u][i]=tr[fail[u]][i];//创建虚拟儿子
            else{//更新fail指针
                que.push(tr[u][i]);
                fail[tr[u][i]]=tr[fail[u]][i];
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;查询&lt;/h1&gt;
&lt;p&gt;运用虚拟儿子解决了匹配失败的问题。那么匹配成功走真的儿子，匹配失败走假的儿子，就可以忽略这一差别，直接向下走。我们上一章讲了在字符串末尾打上标记，查询的时候就可以直接向下走，然后记录遇到了几个标记，并且把他清零（如果只需要匹配一次的话）。&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void find(string s){
    int u=0,c;
    for(int i=0;i&amp;lt;s.length();i++){
        c=s[i]-&apos;a&apos;;
        u=tr[u][c];//向下走一步
        ans+=bo[u];
        bo[u]=0;//确保同一字符串只被统计一次
    }
    return;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;代码实践&lt;/h1&gt;
&lt;p&gt;洛谷：&lt;a href=&quot;https://www.luogu.com.cn/problem/P3808&quot;&gt;P3808&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string&amp;gt;
#include&amp;lt;queue&amp;gt;

using namespace std;

#define N 1000009

int n;
int ans,cnt;
int fail[N];
int tr[N][30];
int bo[N];
 
void make(string s){
    int u=0;
    for(int i=0;i&amp;lt;s.length();++i){
        int c=s[i]-&apos;a&apos;;
        if(!tr[u][c]){
            tr[u][c]=++cnt;
        }
        u=tr[u][c];
    }
    bo[u]++;
    return;
}

queue&amp;lt;int&amp;gt; que;
void bfs(){
    for(int i=0;i&amp;lt;=25;i++){
        if(tr[0][i])que.push(tr[0][i]);
    }
    while(!que.empty()){
        int u=que.front();
        que.pop();
        for(int i=0;i&amp;lt;=25;i++){
            if(!tr[u][i])   tr[u][i]=tr[fail[u]][i];//创建虚拟儿子
            else{//更新fail指针
                que.push(tr[u][i]);
                fail[tr[u][i]]=tr[fail[u]][i];
            }
        }
    }
}

void find(string s){
    int u=0,c;
    for(int i=0;i&amp;lt;s.length();i++){
        c=s[i]-&apos;a&apos;;
        u=tr[u][c];
        ans+=bo[u];
        bo[u]=0;//确保同一字符串只被统计一次
    }
    return;
}

int main(){
    int n;
    string s;
    ans=0;cnt=0;

    cin&amp;gt;&amp;gt;n;

    //输入模式串
    while(n--){
        cin&amp;gt;&amp;gt;s;
        //建立trie树
        make(s);
    }

    //建立next指针
    bfs();
    
    //输入文本串
    cin&amp;gt;&amp;gt;s;
    //ac自动机
    find(s);

    cout&amp;lt;&amp;lt;ans&amp;lt;&amp;lt;endl;
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;
</content:encoded></item><item><title>字典树(Trie)</title><link>https://blog.haoye.plus/posts/trie/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/trie/</guid><description>Trie</description><pubDate>Sat, 18 Nov 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;AC自动机的前置知识（=^^）/&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#%E9%97%AE%E9%A2%98&quot;&gt;问题&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%AD%97%E5%85%B8%E6%A0%91%E5%89%8A%E5%BC%B1%E7%89%88&quot;&gt;字典树~削弱版~&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%AD%97%E5%85%B8%E6%A0%91&quot;&gt;字典树&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%9F%A5%E8%AF%A2&quot;&gt;查询&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BB%A3%E7%A0%81%E5%AE%9E%E8%B7%B5&quot;&gt;代码实践&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;问题&lt;/h1&gt;
&lt;p&gt;给定很多个文本串 &lt;code&gt;t[i]&lt;/code&gt; 和很多个模式串 &lt;code&gt;s[i]&lt;/code&gt; 。怎样算出每个文本串是多少个模式串的前缀？&lt;/p&gt;
&lt;h1&gt;字典树~削弱版~&lt;/h1&gt;
&lt;p&gt;我们一个一个匹配显然太慢了。有没有什么方法可以简化这个流程呢？&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-18%2019-47-15.png&quot; alt=&quot;美丽的Trie图&quot; /&gt;&lt;/p&gt;
&lt;p&gt;这就是，，，，&lt;strong&gt;字典树&lt;/strong&gt;！！&lt;/p&gt;
&lt;p&gt;可以从上面的图片看到，对于多个字符串，如果把他们的公共前缀合在一起，最终得到的结果类似于一个树。这样具有公共前缀的不同字符串只用枚举一次就可以了！！！（这就是为什么它也叫&lt;strong&gt;前缀树&lt;/strong&gt;）&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;不过&lt;/strong&gt;，这张图片还有点不完美。我们并不知道有几个模式串有这个前缀。可以在字典树的每个节点加一个数据 &lt;code&gt;num[i]&lt;/code&gt;（在图片右下角），记录拥有这个公共前缀的字符串的个数。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;再&lt;/strong&gt;给每个字符串的末尾打上标记后（虽然对于上面的问题来说这个步骤不重要，但是看到下一章的AC自动机（&lt;s&gt;自动AC机&lt;/s&gt;）来说，这个就重要了），我们就得到了一个比较完美的字典树。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-18%2019-46-55.png&quot; alt=&quot;高级智慧炫酷充满力量的最终版本字典树&quot; /&gt;&lt;/p&gt;
&lt;p&gt;可我们还没有考虑一种情况。&lt;/p&gt;
&lt;h1&gt;字典树&lt;/h1&gt;
&lt;p&gt;有没有发现，上一节这些字符串们的第一个字符都是 &lt;code&gt;O&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;对于第一个字符不同的字符串该怎么弄呢？&lt;/p&gt;
&lt;p&gt;我们可以定义一个虚拟的&lt;strong&gt;根节点&lt;/strong&gt;。这个节点并没有实际的值，只不过是为了链接第一个字符不同的字符串们的。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-18%2019-43-22.png&quot; alt=&quot;根节点特写&quot; /&gt;&lt;/p&gt;
&lt;p&gt;为了演示方便，把根节点染成了黄色（其实代码实际用起来并不用做特别区分）。&lt;/p&gt;
&lt;p&gt;把字符串A改为 &lt;code&gt;IF&lt;/code&gt; 后，我们就得到了最终版本的字典树了。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-18%2019-50-37.png&quot; alt=&quot;高级智慧炫酷充满力量的最终版本字典树+++&quot; /&gt;&lt;/p&gt;
&lt;h1&gt;查询&lt;/h1&gt;
&lt;p&gt;查询很简单。只要在文本串从头到尾遍历，然后在字典树中从上到下遍历就好了。&lt;/p&gt;
&lt;p&gt;如果遍历着遍历着下面没节点了，说明文本串不是任何模式串的前缀。&lt;/p&gt;
&lt;p&gt;如果遍历着遍历着文本串没了，那么此时所在的节点所记录的 &lt;code&gt;num[i]&lt;/code&gt; 就是最终的答案。&lt;/p&gt;
&lt;p&gt;（可以想想为什么会这样。&lt;s&gt;（绝对不是懒得写了）&lt;/s&gt;）&lt;/p&gt;
&lt;h1&gt;代码实践&lt;/h1&gt;
&lt;p&gt;洛谷：&lt;a href=&quot;https://www.luogu.com.cn/problem/P8306&quot;&gt;P8306&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt; //万能头！！！

using namespace std;

int cnt;
int trie[3000009][70];
int num[3000009];

int c2i(char x){
    if(&apos;a&apos;&amp;lt;=x and x&amp;lt;=&apos;z&apos;)return x - &apos;a&apos; + 1;
    if(&apos;A&apos;&amp;lt;=x and x&amp;lt;=&apos;Z&apos;)return x - &apos;A&apos; + 27;
    if(&apos;0&apos;&amp;lt;=x and x&amp;lt;=&apos;9&apos;)return x - &apos;0&apos; + 53;
}

inline void clearTrie(){
    for(int i=0;i&amp;lt;=cnt;i++){
        for(int j=0;j&amp;lt;70;j++){
            trie[i][j]=0;
        }
        num[i]=0;
    }
    cnt = 0;
}

inline void pushTrie(string x){
    int u=0;
    for(int i=0;i&amp;lt;x.length();i++){
        int c = c2i(x[i]);
        if(!trie[u][c]){
            trie[u][c]=++cnt;
        }
        u=trie[u][c];
        num[u]++;
    }
}

int queryTrie(string x){
    int i,u;
    i=u=0;
    while(i&amp;lt;x.length() &amp;amp;&amp;amp; trie[u][c2i(x[i])]){
        u=trie[u][c2i(x[i])];
        i++;
    }
    if(i == x.length()){
        return num[u];
    }
    return 0;
}

int main(){
    int t;
    cin&amp;gt;&amp;gt;t;
    while(t--){
        clearTrie();
        int n,q;
        cin&amp;gt;&amp;gt;n&amp;gt;&amp;gt;q;
        while(n--){
            string x;
            cin&amp;gt;&amp;gt;x;
            pushTrie(x);
        }
        while(q--){
            string x;
            cin&amp;gt;&amp;gt;x;
            cout&amp;lt;&amp;lt;queryTrie(x)&amp;lt;&amp;lt;endl;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
</content:encoded></item><item><title>拓展kmp (exkmp/ Z function)</title><link>https://blog.haoye.plus/posts/exkmp/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/exkmp/</guid><description>Z function</description><pubDate>Sat, 11 Nov 2023 00:00:00 GMT</pubDate><content:encoded>&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%BC%95%E5%85%A5&quot;&gt;引入&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E8%AE%A1%E7%AE%97extend%E6%95%B0%E7%BB%84&quot;&gt;计算extend数组&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%B1%82%E8%A7%A3extend%E6%95%B0%E7%BB%84%E7%9A%84%E6%9C%80%E5%B0%8F%E5%80%BC&quot;&gt;求解extend数组的最小值&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%8B%93%E5%B1%95&quot;&gt;拓展&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#next-%E6%95%B0%E7%BB%84&quot;&gt;next 数组&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BB%A3%E7%A0%81%E5%AE%9E%E8%B7%B5&quot;&gt;代码实践&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;引入&lt;/h1&gt;
&lt;p&gt;KMP算法可以求解出一个模式串在文本串中出现的位置。扩展KMP算法（Z函数）在这个思路上进行了延伸。对于文本串S的每一个后缀（如果文本串S长度为n的话，就指的是 &lt;code&gt;S[i:n]&lt;/code&gt; ，其中 &lt;code&gt;(0&amp;lt;=i&amp;lt;=n-1)&lt;/code&gt; ），找到这个后缀与模式串T的最长公共前缀的长度，存储在 &lt;code&gt;extend[i]&lt;/code&gt; 中。设模式串T长度为m，不难发现，如果我们只看 &lt;code&gt;extend[i] = m&lt;/code&gt; 的情况，相当于在文本串S找出模式串T出现的位置，就和原本的KMP算法一样了。&lt;/p&gt;
&lt;p&gt;扩展KMP算法在国外一般叫做Z函数(Z function)。&lt;/p&gt;
&lt;h1&gt;计算extend数组&lt;/h1&gt;
&lt;p&gt;对于模式串T，我们需要预处理一个数组 &lt;code&gt;next&lt;/code&gt; 。其第i项表示从i开始T的后缀与T的最长公共前缀的长度。&lt;code&gt;next&lt;/code&gt; 数组的求解在下节可以看到，我们先来看看如何用 &lt;code&gt;next&lt;/code&gt; 数组计算出 &lt;code&gt;extend&lt;/code&gt; 数组。&lt;/p&gt;
&lt;p&gt;和之前说的马拉车算法类似，拓展KMP算法也是利用之前的数据对暴力算法进行优化。维护一个当前所到达过的最右边的值 &lt;code&gt;right&lt;/code&gt; 以及所对应的起点 &lt;code&gt;left&lt;/code&gt; （即 &lt;code&gt;left + extend[left] - 1&lt;/code&gt; 的最大值为 &lt;code&gt;right&lt;/code&gt; ）。此时在第 &lt;code&gt;i&lt;/code&gt; 项，默认其前面的 &lt;code&gt;extend[i-1], extend[i-2], ... extend[0]&lt;/code&gt; 都已经更新完毕。&lt;/p&gt;
&lt;p&gt;如果 &lt;code&gt;i &amp;gt; right&lt;/code&gt; ，说明此时第 &lt;code&gt;i&lt;/code&gt; 项还没有更新。此时就用最简单的暴力算法向前推进，并且更新 &lt;code&gt;left&lt;/code&gt; 和 &lt;code&gt;right&lt;/code&gt; 的值。&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;left = i;
while((i+extend[i])&amp;lt;s.length() &amp;amp;&amp;amp; (extend[i])&amp;lt;t.length() &amp;amp;&amp;amp; t[extend[i]] == s[i+extend[i]]){//思考题：为什么这里没有+1
	extend[i]++;
}
right = left + extend[i] - 1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;如果 &lt;code&gt;i &amp;lt;= right&lt;/code&gt; ，就可以利用 &lt;code&gt;left&lt;/code&gt; 和 &lt;code&gt;right&lt;/code&gt; 的值来更新 &lt;code&gt;extend[i]&lt;/code&gt; 了。&lt;/p&gt;
&lt;h2&gt;求解extend数组的最小值&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-11%2019-59-13.png&quot; alt=&quot;extend高级图片2&quot; /&gt;&lt;/p&gt;
&lt;p&gt;从上图结合之前学的内容可知， &lt;code&gt;S[left:right+1]&lt;/code&gt; 和 &lt;code&gt;T[0:right-left+1]&lt;/code&gt; 的值是相同的。也就是 &lt;code&gt;S[i:right+1]&lt;/code&gt; 与 &lt;code&gt;T[i-left:right-left+1]&lt;/code&gt; 的值是相同的（图中红色区域和绿色区域是相同的）。&lt;code&gt;next[i-left] = 2&lt;/code&gt; 可以求得 &lt;code&gt;T[0:2] = T[i - left:i - left + 2 + 1]&lt;/code&gt; 也就是黄色区域等于绿色区域的前两个。又因为红色区域等于绿色区域，所以红色区域前两个等于黄色区域。也就是文本串S以第i项开头的后缀与模式串T的最长公共前缀为2，也就是黄色区域的长度 &lt;code&gt;next[i - left]&lt;/code&gt;。进而得到 &lt;code&gt;extend[i] = next[i - left] &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-11%2020-03-04.png&quot; alt=&quot;extend高级图片1&quot; /&gt;&lt;/p&gt;
&lt;p&gt;我们再来看一个例子。&lt;/p&gt;
&lt;p&gt;根据上文所述的方法画出红色，绿色和黄色区域。我们会发现套用上一个结论行不通。因为黄色区域的长度已经超过了红色区域的长度。而我们只能保证红色区域与绿色区域相同，并不能保证红色区域的下一个值和绿色区域的下一个值相同，也就是 &lt;code&gt;S[5]&lt;/code&gt; 和 &lt;code&gt;T[4]&lt;/code&gt; 不能确定是否相同。此时就应该用红色区域的长度作为 &lt;code&gt;extend[i]&lt;/code&gt; 的值。&lt;code&gt;extend[i] = right - i + 1&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;综上，可以得出一个通用式子。&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;extend[i] = min(right - i + 1, next[i - left]);
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;拓展&lt;/h2&gt;
&lt;p&gt;如果 &lt;code&gt;i + extend[i] - 1 = right&lt;/code&gt; ，说明本次更新已经到了 &lt;code&gt;s[left:right+1]&lt;/code&gt; 所管辖的尽头，需要对其进行更新。此时就和暴力的时候一样就好了，拓展 &lt;code&gt;extend[i]&lt;/code&gt; 的值并且更新 &lt;code&gt;left&lt;/code&gt; 和 &lt;code&gt;right&lt;/code&gt;。&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if(i + extend[i] - 1 &amp;gt; right){
    left = i;
    while((i+extend[i])&amp;lt;s.length() &amp;amp;&amp;amp; (extend[i])&amp;lt;t.length() &amp;amp;&amp;amp; t[extend[i]] == s[i+extend[i]]){//思考题：为什么这里没有+1
        extend[i]++;
    }
    right = i + extend[i] - 1
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;next 数组&lt;/h1&gt;
&lt;p&gt;其实和上一节很相似，只不过是文本串和模式串都是T而已。这里就直接上代码&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void calNextt(){
    nextt[0] = t.length(); // 自己和自己的最长公共前缀就是自己本身
    int left,right;
    left = right = 0;
    for(int i=1;i&amp;lt;t.length();i++){
        if(i&amp;lt;=right)
            nextt[i] = min(right-i+1,nextt[i-left]);
        while((i+nextt[i])&amp;lt;t.length() &amp;amp;&amp;amp; t[nextt[i]] == t[i+nextt[i]]){
            nextt[i]++;
        }
        if(i+nextt[i]-1&amp;gt;right){
            left = i;
            right = i+nextt[i]-1;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;代码实践&lt;/h1&gt;
&lt;p&gt;代码实践：&lt;a href=&quot;https://www.luogu.com.cn/problem/P5410&quot;&gt;洛谷P5410&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;不要忘了用long long!!!!（改了很久的愤怒）&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//LICENSE: GPL v3.0
//https://blog.haoye.plus

#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string&amp;gt;
#define int long long
using namespace std;
string s,t;
int nextt[20000009];//next 为保留字，不能用
int extend[20000009];

void calNextt();
void calExtend();

signed main(){
    cin&amp;gt;&amp;gt;s&amp;gt;&amp;gt;t;

    calNextt();
    //计算答案
    int ans = nextt[0]+1;
    for(int i=1;i&amp;lt;t.length();i++)
        ans = ans xor ((i+1)*(nextt[i]+1));
    cout&amp;lt;&amp;lt;ans&amp;lt;&amp;lt;endl;

    calExtend();
    //计算答案
    ans = extend[0]+1;
    for(int i=1;i&amp;lt;s.length();i++){
        ans = ans xor ((i+1)*(extend[i]+1));
    }
    cout&amp;lt;&amp;lt;ans&amp;lt;&amp;lt;endl;

    return 0;
}

void calNextt(){
    nextt[0] = t.length(); // 自己和自己的最长公共前缀就是自己本身
    int left,right;
    left = right = 0;
    for(int i=1;i&amp;lt;t.length();i++){
        if(i&amp;lt;=right)
            nextt[i] = min(right-i+1,nextt[i-left]);
        while((i+nextt[i])&amp;lt;t.length() &amp;amp;&amp;amp; t[nextt[i]] == t[i+nextt[i]]){
            nextt[i]++;
        }
        if(i+nextt[i]-1&amp;gt;right){
            left = i;
            right = i+nextt[i]-1;
        }
    }
}

void calExtend(){
    extend[0]=0;
    while((extend[0])&amp;lt;s.length() &amp;amp;&amp;amp; (extend[0])&amp;lt;t.length() &amp;amp;&amp;amp; t[extend[0]] == s[extend[0]]){
        extend[0]++;
    }

    int left,right;
    left = 0;
    right = extend[0]-1;
    for(int i=1;i&amp;lt;s.length();i++){
        if(i&amp;lt;=right)
            extend[i] = min(right-i+1,nextt[i-left]);
        while((i+extend[i])&amp;lt;s.length() &amp;amp;&amp;amp; (extend[i])&amp;lt;t.length() &amp;amp;&amp;amp; t[extend[i]] == s[i+extend[i]]){
            extend[i]++;
        }
        if(i+extend[i]-1&amp;gt;right){
            left = i;
            right = i+extend[i]-1;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
</content:encoded></item><item><title>马拉车算法 (Manacher)</title><link>https://blog.haoye.plus/posts/manacher/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/manacher/</guid><description>Manacher Algorithm</description><pubDate>Sun, 05 Nov 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;马拉车算法可以用线性级时间复杂度找出最长回文子串。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%9B%9E%E6%96%87%E5%AD%90%E4%B8%B2&quot;&gt;回文子串&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BF%AE%E6%94%B9%E5%9B%9E%E6%96%87%E4%B8%B2&quot;&gt;修改回文串&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#on2-%E6%B1%82%E8%A7%A3&quot;&gt;O(n^2) 求解&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E9%A9%AC%E6%8B%89%E8%BD%A6%E7%AE%97%E6%B3%95%E6%80%9D%E8%B7%AF&quot;&gt;马拉车算法思路&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BB%A3%E7%A0%81%E5%AE%9E%E8%B7%B5&quot;&gt;代码实践&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;回文子串&lt;/h1&gt;
&lt;p&gt;考虑这么一种字符串，它正着读和倒着读的内容都一样。我们称这种字符串为回文串。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-04%2020-53-11.png&quot; alt=&quot;回文串图片&quot; /&gt;&lt;/p&gt;
&lt;p&gt;接下来的算法目的是在一个字符串的所有子串中找到一个长度最长的回文串，也就是最长回文子串。&lt;/p&gt;
&lt;h1&gt;修改回文串&lt;/h1&gt;
&lt;p&gt;根据回文串长度的奇偶性，可以将它分为两类: 长度为奇数的回文串和长度为偶数的回文串。长度为奇数的回文串中心只有一个元素，而长度为偶数的有两个。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-04%2021-07-44.png&quot; alt=&quot;两种回文串&quot; /&gt;&lt;/p&gt;
&lt;p&gt;如果对于这两种回文串进行分类讨论的话，代码会变得更加复杂。我们可以在回文串的左右两边和每个字符之间加上一个特殊字符。这样就只用讨论长度为奇数的回文串。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-04%2021-09-42.png&quot; alt=&quot;加了特殊字符的两种回文串&quot; /&gt;&lt;/p&gt;
&lt;h1&gt;O(n^2) 求解&lt;/h1&gt;
&lt;p&gt;很容易想到的一种思路就是暴力枚举。以每一个元素为回文串的中心同时向左右扩散，直到碰到边缘或者左右字符不一致时停止。这被称作中心扩散法。&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
char s[22000010];
int n;
int p[22000010];
int maxx;
inline void algorithm(){
​    for(int i=0;i&amp;lt;n;i++){
​        //扩散
​        while(i - p[i] -1 &amp;gt;= 0 &amp;amp;&amp;amp; i + p[i] + 1 &amp;lt; n &amp;amp;&amp;amp; s[i+p[i]+1] == s[i-p[i]-1]){
​            p[i]++;
​        }
​        //更新最终答案
​        maxx = max(maxx,p[i]);
​    }
}
int main(){
​    //输入并添加特殊字符
​    char c;
​    c=getchar();
​    while(&apos;a&apos;&amp;lt;=c &amp;amp;&amp;amp; c&amp;lt;=&apos;z&apos;){
​        s[n++]=&apos;#&apos;;
​        s[n++]=c;
​        c=getchar();
​    }
​    s[n++]=&apos;#&apos;;
​    maxx = 0;
​    //算法处理
​    algorithm();
​    //输出
​    cout&amp;lt;&amp;lt;maxx&amp;lt;&amp;lt;endl;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;代码会处理添加过特殊字符后的回文串，并记录扩散次数到p数组。&lt;/p&gt;
&lt;p&gt;我们会发现，p数组存储的值正好是对应位置修改前的原始最长回文子串的长度。这样记录好p数组的最大值就可以知道答案了。下面是简短的证明。&lt;/p&gt;
&lt;p&gt;以某一项元素为中心扩散最终左右两边的极限一定是特殊字符。因为不等于的情况永远不是特殊字符（或者碰到边界，不过整个字符串首位就有特殊字符，所以这个情况不难证明），所以最终这个回文串的左右两边的极限肯定都为特殊字符。&lt;/p&gt;
&lt;p&gt;对某一个元素而言，设回文串长度为 &lt;code&gt;2 * l + 1&lt;/code&gt;, 则除去特殊字符的原始字符串长度为 &lt;code&gt;l&lt;/code&gt; ，&lt;code&gt;p[i]&lt;/code&gt; 也等于 &lt;code&gt;l&lt;/code&gt;。所以相等。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-06%2008-29-59.png&quot; alt=&quot;p数组证明&quot; /&gt;&lt;/p&gt;
&lt;h1&gt;马拉车算法思路&lt;/h1&gt;
&lt;p&gt;O(n^2)算法的时间复杂度显然不占优势。利用回文串的性质可以对它进行优化&lt;/p&gt;
&lt;p&gt;马拉车算法会记录两个值。一个是目前所有回文子串中最靠右的右端点的下标 &lt;code&gt;max_right&lt;/code&gt; ，另一个是它所对应的回文串中心的下表 &lt;code&gt;center&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;在进行第一个循环时，如果所在的元素 &lt;code&gt;i&lt;/code&gt; 的下标大于 &lt;code&gt;max_right&lt;/code&gt; 说明目前的回文子串无法覆盖到 &lt;code&gt;i&lt;/code&gt; 。此时就只能用到上文的扩散法计算p数组的值并更新 &lt;code&gt;max_right&lt;/code&gt; 与 &lt;code&gt;center&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;可如果 &lt;code&gt;i&lt;/code&gt; 不大于 &lt;code&gt;max_right&lt;/code&gt; ，说明有之前的回文串可以覆盖到 &lt;code&gt;i&lt;/code&gt; 。此时就可以利用回文串的性质进行优化了。&lt;/p&gt;
&lt;p&gt;利用 &lt;code&gt;i&lt;/code&gt; 关于 &lt;code&gt;center&lt;/code&gt; 对称的元素 &lt;code&gt;mirror&lt;/code&gt;，我们可以计算出 &lt;code&gt;p[center]&lt;/code&gt; 的最小值。&lt;/p&gt;
&lt;p&gt;举个例子，考虑以第9项作为center的情况&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-04%2021-47-35.png&quot; alt=&quot;例子图片&quot; /&gt;&lt;/p&gt;
&lt;p&gt;对于字符串s，可能会出现下面的三种情况。&lt;/p&gt;
&lt;p&gt;如果 &lt;code&gt;p[mirror] &amp;lt; max_right - i&lt;/code&gt; (这里 &lt;code&gt;max_right - i&lt;/code&gt;  代表着以 &lt;code&gt;center&lt;/code&gt; 为中心的回文串最左端离 &lt;code&gt;mirror&lt;/code&gt; 的距离)，此时 &lt;code&gt;p[i] = p[mirror]&lt;/code&gt;。 因为根据回文串的性质， &lt;code&gt;mirror - p[mirror]&lt;/code&gt; 到 &lt;code&gt;mirror + p[mirror]&lt;/code&gt; 是回文串必然能推出 &lt;code&gt;i - p[mirror]&lt;/code&gt; 到 &lt;code&gt;i + p[mirror]&lt;/code&gt; 子串也是回文串。&lt;code&gt;s[ mirror - p[mirror] - 1 ] != s[ mirror + p[mirror] + 1 ]&lt;/code&gt; 也能推导出 &lt;code&gt;s[ i - p[mirror] - 1 ] != s[ i + p[mirror] + 1 ]&lt;/code&gt;，证明这是最长的回文串。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-04%2022-02-32.png&quot; alt=&quot;小于的情况&quot; /&gt;&lt;/p&gt;
&lt;p&gt;如果 &lt;code&gt;p[mirror] = max_right - i&lt;/code&gt; ，同上可知 &lt;code&gt;p[i] = p[mirror]&lt;/code&gt;。 设左端点为 &lt;code&gt;left&lt;/code&gt;，则 &lt;code&gt;s[ mirror-p[mirror]-1 ] != s[ mirror+p[mirror]+1 ]&lt;/code&gt; 不能推导到以 &lt;code&gt;i&lt;/code&gt; 为中心的回文串上。所以此时需要扩散回文串并且更新 &lt;code&gt;max_right&lt;/code&gt; 与 &lt;code&gt;center&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-04%2021-58-32.png&quot; alt=&quot;相等的情况&quot; /&gt;&lt;/p&gt;
&lt;p&gt;如果 &lt;code&gt;p[mirror] &amp;gt; max_right - i&lt;/code&gt; ，此时以 &lt;code&gt;mirror&lt;/code&gt; 为中心的回文串已经超出了以 &lt;code&gt;center&lt;/code&gt; 为中心的回文串的范围。通过以 &lt;code&gt;center&lt;/code&gt; 为中心的回文串的性质所推导出来的结论只适用于这个回文串本身的范围。对于他左端点往左和右端点往右的对称性无法保证。设左端点为 &lt;code&gt;left&lt;/code&gt;，可得到 &lt;code&gt;s[ center-p[left]-1 ] != s[ center+p[right]+1]&lt;/code&gt; 。因此此时 &lt;code&gt;p[i] = max_right - i&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://image.haoye.plus/Screenshot%20from%202023-11-04%2022-04-34.png&quot; alt=&quot;大于的情况&quot; /&gt;&lt;/p&gt;
&lt;h1&gt;代码实践&lt;/h1&gt;
&lt;p&gt;模版题: &lt;a href=&quot;https://www.luogu.com.cn/problem/P3805&quot;&gt;P3805 马拉车&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;C++代码&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
char s[22000010];
int n;
int p[22000010];
int maxx;
inline void manacher(){
​    int center,right;
​    center = -1;
​    right = -1;
​    for(int i=0;i&amp;lt;n;i++){
​        int mirror = center * 2 - i;
​        //如果i在center回文串里面
​        if (i &amp;lt; right){
​            p[i] = min(right - i, p[mirror]);
​        }
​        //扩散
​        while(i - p[i] -1 &amp;gt;= 0 &amp;amp;&amp;amp; i + p[i] + 1 &amp;lt; n &amp;amp;&amp;amp; s[i+p[i]+1] == s[i-p[i]-1]){
​            p[i]++;
​        }
​        //更新right和center
​        if(i+p[i]&amp;gt;right){
​            right = i+p[i];
​            center = i;
​        }
​        //更新最终答案
​        maxx = max(maxx,p[i]);
​    }
}
int main(){
​    //输入并添加特殊字符
​    char c;
​    c=getchar();
​    while(&apos;a&apos;&amp;lt;=c &amp;amp;&amp;amp; c&amp;lt;=&apos;z&apos;){
​        s[n++]=&apos;#&apos;;
​        s[n++]=c;
​        c=getchar();
​    }
​    s[n++]=&apos;#&apos;;
​    maxx = 0;
​    //马拉车
​    manacher();
​    //输出
​    cout&amp;lt;&amp;lt;maxx&amp;lt;&amp;lt;endl;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;封面图来源: &lt;a href=&quot;https://unsplash.com/s/photos/horse&quot;&gt;这里&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</content:encoded></item><item><title>c++语法知识点</title><link>https://blog.haoye.plus/posts/cpp-grammar/</link><guid isPermaLink="true">https://blog.haoye.plus/posts/cpp-grammar/</guid><description>c++ grammar</description><pubDate>Tue, 10 Jan 2023 00:00:00 GMT</pubDate><content:encoded>&lt;h1&gt;c++程序设计&lt;/h1&gt;
&lt;p&gt;by：小鸭呀&lt;/p&gt;
&lt;p&gt;来源：信息学奥赛一本通+菜鸟教程+oiwiki+我的脑袋&lt;/p&gt;
&lt;p&gt;本文章遵循cc协议，转载请署名&lt;/p&gt;
&lt;p&gt;对于本文章的建议或纠错可以发表评论哦（=^^）&lt;/p&gt;
&lt;p&gt;[TOC]&lt;/p&gt;
&lt;p&gt;（如果支持的话应该上面会显示个目录）&lt;/p&gt;
&lt;h2&gt;让程序不闪退的神奇代码&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;system(&quot;pause&quot;)&lt;/code&gt;版本4.99以前&lt;/p&gt;
&lt;p&gt;getchar() 约等于  system(&quot;pause&quot;)&lt;/p&gt;
&lt;h2&gt;注释&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;//这是一行注释
/*这是有头有尾的注释*/
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;标识符&lt;/h2&gt;
&lt;p&gt;含义：标识实体（变量名，函数名，对象名）&lt;/p&gt;
&lt;p&gt;由大小写字母，下划线和数字0~9组成&lt;/p&gt;
&lt;p&gt;必须以大小写字母和下划线开头&lt;/p&gt;
&lt;h2&gt;运算符&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;啥子运算符&lt;/th&gt;
&lt;th&gt;干啥的&lt;/th&gt;
&lt;th&gt;长啥样&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;算数运算符&lt;/td&gt;
&lt;td&gt;数值运算&lt;/td&gt;
&lt;td&gt;+,-,*,/（如果俩操作数是整数，则为整除）,% (俩操作数必须是整数) ,++,--(七种)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;关系运算符&lt;/td&gt;
&lt;td&gt;比较运算&lt;/td&gt;
&lt;td&gt;&amp;gt;,&amp;lt;,==,&amp;lt;=,&amp;gt;=,!=(六种)     返回布尔值&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;逻辑运算符&lt;/td&gt;
&lt;td&gt;逻辑运算&lt;/td&gt;
&lt;td&gt;&amp;amp;&amp;amp;,||,!&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;位操作运算符&lt;/td&gt;
&lt;td&gt;二进制运算&lt;/td&gt;
&lt;td&gt;&amp;amp;,|,~（非),^(异或),&amp;lt;&amp;lt;,&amp;gt;&amp;gt;(六种)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;赋值运算符&lt;/td&gt;
&lt;td&gt;赋值运算&lt;/td&gt;
&lt;td&gt;简单赋值(=),复合算数赋值(+=,-=,*=,/=,%=),复合位运算赋值(&amp;amp;=,|=,^=,&amp;lt;&amp;lt;=,&amp;gt;&amp;gt;=)三类共十一种&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;条件运算符&lt;/td&gt;
&lt;td&gt;条件求值&lt;/td&gt;
&lt;td&gt;条件?结果a:结果b         条件成立，用结果a，否则用结果b&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;逗号运算符&lt;/td&gt;
&lt;td&gt;把若干个表达式组合成一个表达式&lt;/td&gt;
&lt;td&gt;,&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;指针运算符&lt;/td&gt;
&lt;td&gt;取内容，取地址&lt;/td&gt;
&lt;td&gt;取内容(*),取地址(&amp;amp;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;求字节数运算符&lt;/td&gt;
&lt;td&gt;数据类型所占字节数&lt;/td&gt;
&lt;td&gt;sizeof(数据类型)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;特殊运算符&lt;/td&gt;
&lt;td&gt;玛卡巴卡&lt;/td&gt;
&lt;td&gt;(   )   [  ]   .   -&amp;gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;优先级&lt;/h3&gt;
&lt;p&gt;自己打括号&lt;/p&gt;
&lt;h2&gt;常用库函数&lt;/h2&gt;
&lt;p&gt;依赖cmath库：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;格式&lt;/th&gt;
&lt;th&gt;功能&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;abs(x)/fabs(x)&lt;/td&gt;
&lt;td&gt;绝对值&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;exp(x)&lt;/td&gt;
&lt;td&gt;e的x次方&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;floor(x)&lt;/td&gt;
&lt;td&gt;向下取整&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ceil(x)&lt;/td&gt;
&lt;td&gt;向上取整&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;log(x)&lt;/td&gt;
&lt;td&gt;x的自然对数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pow(x,y)&lt;/td&gt;
&lt;td&gt;x的y次方&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sqrt(x)&lt;/td&gt;
&lt;td&gt;根号&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;round(x)&lt;/td&gt;
&lt;td&gt;四舍五入&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sin,cos,tan,acos,asin,atan&lt;/td&gt;
&lt;td&gt;三角函数&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;依赖cstdlib库&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;格式&lt;/th&gt;
&lt;th&gt;功能&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;rand()&lt;/td&gt;
&lt;td&gt;0到RAND-MAX之间随机取一个整数&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;依赖ctime库&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;格式&lt;/th&gt;
&lt;th&gt;功能&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;clock()&lt;/td&gt;
&lt;td&gt;返回程序从开始运行了多少秒&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;依赖algorithm库&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;格式&lt;/th&gt;
&lt;th&gt;功能&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;sort(a,a+n,cmp)&lt;/td&gt;
&lt;td&gt;对长度为n的a数组排序，用cmp方法&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;常量&lt;/h2&gt;
&lt;h3&gt;定义常量&lt;/h3&gt;
&lt;p&gt;#define 变量名 数据&lt;/p&gt;
&lt;p&gt;const 类型 变量名 = 数据;&lt;/p&gt;
&lt;p&gt;常量初始化后不可以改变&lt;/p&gt;
&lt;h3&gt;整型常量&lt;/h3&gt;
&lt;h4&gt;十进制形式&lt;/h4&gt;
&lt;p&gt;如：99，-1&lt;/p&gt;
&lt;h4&gt;八进制形式&lt;/h4&gt;
&lt;p&gt;0开头&lt;/p&gt;
&lt;p&gt;如：012&lt;/p&gt;
&lt;h4&gt;十六进制形式&lt;/h4&gt;
&lt;p&gt;0x开头&lt;/p&gt;
&lt;p&gt;如：0x12A&lt;/p&gt;
&lt;h2&gt;变量&lt;/h2&gt;
&lt;p&gt;int i = 5,j,k(5);    //i，j，k为整型变量，i，k是5，j未知&lt;/p&gt;
&lt;p&gt;a = b = c = 2       等同于    c = 2;b = c;a = b;&lt;/p&gt;
&lt;h2&gt;标准数据类型&lt;/h2&gt;
&lt;h3&gt;整型与实型&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;数据类型&lt;/th&gt;
&lt;th&gt;定义标识符&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;短整型&lt;/td&gt;
&lt;td&gt;short [int]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;整型&lt;/td&gt;
&lt;td&gt;[long] int&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;长整型&lt;/td&gt;
&lt;td&gt;long [int]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;超长整型&lt;/td&gt;
&lt;td&gt;long long [int]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;无符号整型&lt;/td&gt;
&lt;td&gt;unsigned [int]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;无符号短整型&lt;/td&gt;
&lt;td&gt;unsigned short [int]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;无符号长整型&lt;/td&gt;
&lt;td&gt;unsigned long [int]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;无符号超长整型&lt;/td&gt;
&lt;td&gt;unsigned long long&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;单精度实型&lt;/td&gt;
&lt;td&gt;float&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;双精度实型&lt;/td&gt;
&lt;td&gt;double&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;长双精度实型&lt;/td&gt;
&lt;td&gt;long double&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;布尔&lt;/td&gt;
&lt;td&gt;bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;枚举类型&lt;/td&gt;
&lt;td&gt;enum&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;注:科学计数法是指数形式的表示方法，&lt;code&gt;十进制小数E整数指数&lt;/code&gt;，例如
$$
1.2\times10^5
$$
就是1.2E+5&lt;/p&gt;
&lt;h3&gt;枚举类型&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;enum 枚举名{
	标识符,标识符,标识符(=整型常数)
} 枚举变量;
//举个栗子
enum food{drink,eat=5}c;
c=drink;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;重定义数据类型&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;typedef int metre;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;转义字符&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;转义字符&lt;/th&gt;
&lt;th&gt;含义&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;\b&lt;/td&gt;
&lt;td&gt;退格&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\r&lt;/td&gt;
&lt;td&gt;不换行的回车&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\0&lt;/td&gt;
&lt;td&gt;空&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\n&lt;/td&gt;
&lt;td&gt;回车&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;char类型里+32是大写转小写，-32是小写转大写&lt;/p&gt;
&lt;p&gt;强制类型转换：类型名（被转换的可怜变量）&lt;/p&gt;
&lt;h2&gt;输入输出&lt;/h2&gt;
&lt;p&gt;事先说明：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;cstdio&amp;gt;       //这个章节的内容必须有这些语句
using namespace std;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;cout用小于，cin用大于&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;getchar&lt;/h3&gt;
&lt;p&gt;输入单个字符，无参&lt;/p&gt;
&lt;p&gt;char ch;ch=getchar();&lt;/p&gt;
&lt;h3&gt;putchar&lt;/h3&gt;
&lt;p&gt;输出单个字符，有参&lt;/p&gt;
&lt;p&gt;putchar(66)      根据ASCII码66是字符B，输出B&lt;/p&gt;
&lt;h3&gt;cout&lt;/h3&gt;
&lt;h4&gt;setw&lt;/h4&gt;
&lt;p&gt;要导入iomanip库&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;iomanip&amp;gt;
cout&amp;lt;&amp;lt;setw(6)&amp;lt;&amp;lt;a;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;setw控制输出的宽度&lt;/p&gt;
&lt;h3&gt;cstdio 库&lt;/h3&gt;
&lt;h4&gt;输入&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;scanf(&quot;%类型&quot;,&amp;amp;变量名)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;格式符：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;格式符&lt;/th&gt;
&lt;th&gt;说明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;d，i&lt;/td&gt;
&lt;td&gt;十进制整数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;u&lt;/td&gt;
&lt;td&gt;无符号十进制整数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;o&lt;/td&gt;
&lt;td&gt;八进制整数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;x&lt;/td&gt;
&lt;td&gt;十六进制整数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;c&lt;/td&gt;
&lt;td&gt;单个字符&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s&lt;/td&gt;
&lt;td&gt;字符串（非空格开始，空格结束）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;f，e&lt;/td&gt;
&lt;td&gt;实数&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;附加格式说明符：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;附加格式&lt;/th&gt;
&lt;th&gt;说明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;l（L字母）&lt;/td&gt;
&lt;td&gt;长整型或double型&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h&lt;/td&gt;
&lt;td&gt;短型数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;域宽（一个整数）&lt;/td&gt;
&lt;td&gt;输入多少东西&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;*&lt;/td&gt;
&lt;td&gt;不赋值给变量&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;scanf(&quot;%4d,%4d&quot;,&amp;amp;a,&amp;amp;b);&lt;/p&gt;
&lt;p&gt;cout&amp;lt;&amp;lt;a&amp;lt;&amp;lt;&apos;,&apos;&amp;lt;&amp;lt;b&amp;lt;&amp;lt;endl;&lt;/p&gt;
&lt;p&gt;如果输入的是12345678，则输入为1234,5678&lt;/p&gt;
&lt;h5&gt;scanf有返回值！！！！！&lt;/h5&gt;
&lt;p&gt;返回了成功读取的变量的个数哦！！！&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while(scanf(&quot;%d&quot;,&amp;amp;x) != EOF){
​	语句
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;如果成功读取，就执行语句&lt;/p&gt;
&lt;h4&gt;输出&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;printf(格式控制符,输出列表)&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;格式符&lt;/h5&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;格式符&lt;/th&gt;
&lt;th&gt;说明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;d或i&lt;/td&gt;
&lt;td&gt;十进制整数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;u&lt;/td&gt;
&lt;td&gt;无符号十进制整数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;x或X&lt;/td&gt;
&lt;td&gt;十六进制无符号整数（没有前导符0x）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;o&lt;/td&gt;
&lt;td&gt;八进制无符号整数（没有前导符0）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;c&lt;/td&gt;
&lt;td&gt;字符&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s&lt;/td&gt;
&lt;td&gt;字符串&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;f&lt;/td&gt;
&lt;td&gt;单、双精度小数，一般6位&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;e或E&lt;/td&gt;
&lt;td&gt;单、双精度以指数形式输出小数，一般6位&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h5&gt;d格式符&lt;/h5&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;参数&lt;/th&gt;
&lt;th&gt;说明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;d&lt;/td&gt;
&lt;td&gt;数字本身长度&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;md&lt;/td&gt;
&lt;td&gt;输出m位&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-md&lt;/td&gt;
&lt;td&gt;同上，但左对齐&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ld&lt;/td&gt;
&lt;td&gt;长整型&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mld&lt;/td&gt;
&lt;td&gt;输出m位，左补空格&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0md或0mld&lt;/td&gt;
&lt;td&gt;位数不足m位补0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h5&gt;f格式符&lt;/h5&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;参数&lt;/th&gt;
&lt;th&gt;说明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;f&lt;/td&gt;
&lt;td&gt;实数格式，小数6位&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;m.nf&lt;/td&gt;
&lt;td&gt;总位数m（含小数点），n位小数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-m.nf&lt;/td&gt;
&lt;td&gt;同上，左对齐&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h5&gt;s格式符&lt;/h5&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;参数&lt;/th&gt;
&lt;th&gt;说明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;s&lt;/td&gt;
&lt;td&gt;字符串&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ms&lt;/td&gt;
&lt;td&gt;指定宽度m&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-ms&lt;/td&gt;
&lt;td&gt;同上，左对齐&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;m.ns&lt;/td&gt;
&lt;td&gt;输出m个字符位置，字符数最多n个&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-m.ns&lt;/td&gt;
&lt;td&gt;同上，左对齐&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;分支&lt;/h2&gt;
&lt;h3&gt;if&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;//基本
if(条件){
	主体;
}

//if...else
if(条件){
	主体1;
} else {
	主体2;
}

//else if
if (条件1) {
	主体1;
} else if (条件2) {
	主体2;
} else if (条件3) {
	主体3;
} else {
	主体4;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;switch&lt;/h3&gt;
&lt;p&gt;case后面要加break哦&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//实例
switch (a){
    case 1:{
        xxx;
        break;
    }
    case 2:{
        xxx;
        break;
    }
    default :{
        xxx;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;循环&lt;/h2&gt;
&lt;h3&gt;for&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;for(初始化;条件;更新){
	循环体;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;while&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;while(条件){
	循环体;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;do...while&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;do {
	循环体;
} while (条件);
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;break 和 continue&lt;/h3&gt;
&lt;p&gt;break跳出循环，continue结束本次循环，前往下次循环&lt;/p&gt;
&lt;h2&gt;数组&lt;/h2&gt;
&lt;p&gt;初始化：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int a[5] = {1,2,3,4,5}   //初始化
int a[5] = {}      //初始化为0
int a[5] = {1,2}   //初始化为1,2,0,0,0
//读取
a[i];
    
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;复制&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;cstring&amp;gt;
memcpy(b,a,sizeof(a))   //a复制到b
memcpy(b,a,sizeof(/*a的数据类型*/)*k)   //a复制k个元素到数组b
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;清零&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;cstring&amp;gt;
int a[5];
memset(a,0/*除了str类型的数组其它只能为0和-1*/,sizeof(a))    //清零
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;二维数组&lt;/h2&gt;
&lt;p&gt;数组的数组&lt;/p&gt;
&lt;h3&gt;格式&lt;/h3&gt;
&lt;p&gt;数据类  数组名  [常量表达式1] [常量表达式2]&lt;/p&gt;
&lt;p&gt;创造后为：常量表达式1行，常量表达式2列&lt;/p&gt;
&lt;h2&gt;程序运行时间&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;ctime&amp;gt;
#include&amp;lt;iostream&amp;gt;
using namespace std;
int main(){
    ...代码
    cout&amp;lt;&amp;lt;clock()/CLOCKS_PER_SEC&amp;lt;&amp;lt;endl;   //输出用时
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;字符类型、字符数组和字符串&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;序号&lt;/th&gt;
&lt;th&gt;函数 &amp;amp; 目的&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;strcpy(s1, s2);&lt;/strong&gt; 复制字符串 s2 到字符串 s1。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;strcat(s1, s2);&lt;/strong&gt; 连接字符串 s2 到字符串 s1 的末尾。连接字符串也可以用 &lt;strong&gt;+&lt;/strong&gt; 号，例如: &lt;code&gt;string str1 = &quot;runoob&quot;; string str2 = &quot;google&quot;; string str = str1 + str2;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;strlen(s1);&lt;/strong&gt; 返回字符串 s1 的长度。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;strcmp(s1, s2);&lt;/strong&gt; 如果 s1 和 s2 是相同的，则返回 0；如果 s1&amp;lt;s2 则返回值小于 0；如果 s1&amp;gt;s2 则返回值大于 0。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;strchr(s1, ch);&lt;/strong&gt; 返回一个指针，指向字符串 s1 中字符 ch 的第一次出现的位置。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;strstr(s1, s2);&lt;/strong&gt; 返回一个指针，指向字符串 s1 中字符串 s2 的第一次出现的位置。&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;字符类型&lt;/h3&gt;
&lt;p&gt;一个字符&lt;/p&gt;
&lt;h3&gt;字符数组&lt;/h3&gt;
&lt;p&gt;装字符的数组&lt;/p&gt;
&lt;h4&gt;输入&lt;/h4&gt;
&lt;p&gt;gets(字符串名称);&lt;/p&gt;
&lt;p&gt;getchar(); //返回字符，回车后才输入&lt;/p&gt;
&lt;p&gt;只能输入一个字符串！！！&lt;/p&gt;
&lt;h4&gt;输出&lt;/h4&gt;
&lt;p&gt;puts(字符串名称);&lt;/p&gt;
&lt;p&gt;putchar(一个字符);&lt;/p&gt;
&lt;p&gt;输入后会自动换行&lt;/p&gt;
&lt;h3&gt;字符串&lt;/h3&gt;
&lt;p&gt;结尾为”\0“，不计入字符串的实际长度&lt;/p&gt;
&lt;h4&gt;字符串的输入输出&lt;/h4&gt;
&lt;p&gt;cin：输入、忽略开头的制表符、换行符、空格。遇到空格或换行停止（不会读取空字符）&lt;/p&gt;
&lt;p&gt;getline：输入、直接读取一行内所有内容，包括空格。格式为&lt;code&gt;getline(cin,字符串变量)&lt;/code&gt;&lt;/p&gt;
&lt;h4&gt;字符串的常用操作&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;字符串s的操作&lt;/th&gt;
&lt;th&gt;意义&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;s.empty()&lt;/td&gt;
&lt;td&gt;s空？返回true否则false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s.size()&lt;/td&gt;
&lt;td&gt;s中字符个数&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s[i]&lt;/td&gt;
&lt;td&gt;s中第i个，从0开始&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s1+s2&lt;/td&gt;
&lt;td&gt;连接s1和s2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s1=s2&lt;/td&gt;
&lt;td&gt;s1替换为s2的副本&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s1==s2&lt;/td&gt;
&lt;td&gt;一样true，否则false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!=,&amp;lt;,&amp;lt;=,&amp;gt;,&amp;gt;=&lt;/td&gt;
&lt;td&gt;原意，不变&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s.insert(pos,s2)&lt;/td&gt;
&lt;td&gt;s里面pos位置前插入s2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s.substr(pos,n)&lt;/td&gt;
&lt;td&gt;返回从pos起的n个字符，返回string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s.erase(pos,n)&lt;/td&gt;
&lt;td&gt;删除从pos起的n个字符&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s.replace(pos,n,s2)&lt;/td&gt;
&lt;td&gt;替换从pos起的n个字符为s2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s.find(s2,pos)&lt;/td&gt;
&lt;td&gt;寻从pos下标起查找s2第一次出现的位置，找不到返回string::npos&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s.c_str&lt;/td&gt;
&lt;td&gt;返回与s内容相同的C语言风格的字符串临时指针&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sscanf(s,&quot;%d&quot;,%N)&lt;/td&gt;
&lt;td&gt;约等于n=int(s)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sprintf(s,&quot;%d&quot;,N)&lt;/td&gt;
&lt;td&gt;约等于s=str(n)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s.substr(2,4)&lt;/td&gt;
&lt;td&gt;python中s[2,2+4-1]&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4&gt;字典序&lt;/h4&gt;
&lt;h4&gt;定义&lt;/h4&gt;
&lt;p&gt;从前往后，挨个比较。第i不同，用i比较。如果相等，谁长谁大。一样的话，相等。&lt;/p&gt;
&lt;h4&gt;方法&lt;/h4&gt;
&lt;p&gt;s1.compare(s2)&lt;/p&gt;
&lt;p&gt;如果相等返回0，s1小于s2返回小于0，s1大于s2返回大于0&lt;/p&gt;
&lt;h3&gt;注意&lt;/h3&gt;
&lt;p&gt;字符串和字符数组的区别在于字符串的结尾是&apos;\0&apos;&lt;/p&gt;
&lt;h2&gt;函数&lt;/h2&gt;
&lt;h3&gt;定义&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;void swap(int &amp;amp;a,int &amp;amp;b);//声明
//主体
void swap(int &amp;amp;a,int &amp;amp;b){
    int tmp = a;a = b;b = tmp;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;传址调用&lt;/p&gt;
&lt;h3&gt;匿名函数&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;[闭包](参数){函数体}                 //不指定返回值类型
[闭包](参数) -&amp;gt; 返回值类型 {函数体}   //指定返回值类型
&lt;/code&gt;&lt;/pre&gt;
&lt;h4&gt;闭包&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;[]        //未定义变量.试图在Lambda内使用任何外部变量都是错误的.
[x, &amp;amp;y]   //x 按值捕获, y 按引用捕获.
[&amp;amp;]       //用到的任何外部变量都隐式按引用捕获
[=]       //用到的任何外部变量都隐式按值捕获
[&amp;amp;, x]    //x显式地按值捕获. 其它变量按引用捕获
[=, &amp;amp;z]   //z按引用捕获. 其它变量按值捕获
//来源:https://www.cnblogs.com/pzhfei/archive/2013/01/14/lambda_expression.html
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;文件操作&lt;/h2&gt;
&lt;h3&gt;freopen&lt;/h3&gt;
&lt;p&gt;需要导入cstdio库&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;cstdio&amp;gt;
freopen(&quot;in.txt&quot;,&quot;r&quot;,stdin);
freopen(&quot;out.txt&quot;,&quot;w&quot;,stdout);
fclose(stdin);fclose(stdout);/*
freopen(&quot;CON&quot;,&quot;r&quot;,stdin);
freopen(&quot;CON&quot;,&quot;w&quot;,stdout);*/
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;fopen&lt;/h3&gt;
&lt;p&gt;fopen版本&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//定义文件指针
FILE *fin,*fout;
fin=fopen(&quot;in.txt&quot;,&quot;rb&quot;);
fout=fopen(&quot;out.txt&quot;,&quot;wb&quot;);
fscanf(fin,&quot;%d&quot;,&amp;amp;temp);
fprintf(fout,&quot;%d\n&quot;,sum);
fclose(fin);fclose(fout);
//切换回标准输入输出
fin=stdin;
fout=stdout;
fscanf(fin,&quot;%d&quot;,&amp;amp;temp);
fprintf(fout,&quot;%d\n&quot;,sum);
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;流&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;#include&amp;lt;cstdio&amp;gt;
#include&amp;lt;fstream&amp;gt;
ifstream fin(&quot;haoye.in&quot;);//定义输入流fin
ofstream fout(&quot;huaiye.out&quot;);//定义输出流fout
int main(){
	//fin输入，fout输出，用法和cin，cout一样
	fin.close();
	fout.close();
	return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;结构体&lt;/h2&gt;
&lt;h3&gt;建立&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;struct 名字 {
	类型名 变量名;
	结构体名字指针 变量名;
} 变量名;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;访问&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;名字.元素
指针-&amp;gt;元素
(*指针).元素
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;指针&lt;/h2&gt;
&lt;h3&gt;定义和运算&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;说明&lt;/th&gt;
&lt;th&gt;样例&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;定义：类型 *变量名&lt;/td&gt;
&lt;td&gt;int a=10;int *p;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;取地址运算符：&amp;amp;&lt;/td&gt;
&lt;td&gt;p = &amp;amp;a;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;间接运算符：*&lt;/td&gt;
&lt;td&gt;*p = 20;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;指针可以和整数加减，每加一，偏移一个类型的长度&lt;/p&gt;
&lt;h3&gt;初始化&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;方法&lt;/th&gt;
&lt;th&gt;说明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;int *p = NULL;&lt;/td&gt;
&lt;td&gt;声明零指针&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;int a;int *p=&amp;amp;a;&lt;/td&gt;
&lt;td&gt;p初始化为a的地址&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;int *p = new(int);&lt;/td&gt;
&lt;td&gt;申请一个空间给p，*p内容不确定&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;无类型指针&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;void *p;
int a = 10;
p = &amp;amp;a;
cout&amp;lt;&amp;lt;*(int*)p&amp;lt;&amp;lt;endl;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;指针作为函数参数&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;void swap(int *x,int *y){
	int t=*x;
	*x=*y;
	*y=t;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;函数指针&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;int t(int a){
	return a;
}
int main(){
	cout&amp;lt;&amp;lt;t&amp;lt;&amp;lt;endl;
    int (*p)(int a);//定义函数指针变量,不能写成*p(int a)
    p=t;
    cout&amp;lt;&amp;lt;p(5)&amp;lt;&amp;lt;&quot;,&quot;&amp;lt;&amp;lt;(*p)(10)&amp;lt;&amp;lt;endl;
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;还有一种定义的方法&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void t1(){cout&amp;lt;&amp;lt;&quot;1&quot;;}
void t2(){cout&amp;lt;&amp;lt;&quot;2&quot;;}
void t3(){cout&amp;lt;&amp;lt;&quot;3&quot;;}
void t4(){cout&amp;lt;&amp;lt;&quot;4&quot;;}
int sum(int a,int b){return a+b;}
typedef int (*LP)(int,int);
typedef void(*aa)();
int main(){
    aa a[]={t1,t2,t3,t4}
    a[1]();   //输出2
    LP p = sum;
    cout&amp;lt;&amp;lt;p(2,5);     //返回7
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;结构体指针&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;struct a{
    float b;
} *p;//这个可以
a *p;//这个也行
//应用结构体指针变量
p-&amp;gt;b
(*p).score
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;动态&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;int *p = new int(1234);
delete p;
int *p = new int[114514];
delete[] p;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;类（oop）&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;//基本：
class 类名{
	//访问修饰符：private/public/protected
    //变量
    //方法
    返回类型 operator/*跟上要改的运算符号*/(参数){
        阿巴阿巴;
    };
    virtual int haoye(){//调用函数的时候都用子类的，不用这个函数
        ;
    }
};
//派生类
class 好耶 : public/*访问修饰符*/ 坏耶 ,其他父类...{
    阿巴阿巴;
    int haoye(){
        ;
    }
};
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;lt;input type=&quot;checkbox&quot; class=&quot;hooray&quot;&amp;gt;&lt;/p&gt;
</content:encoded></item></channel></rss>