Classic
Clean & simple
Crystal
Glassmorphism + Neon
Cyberpunk
Neon glitch art
🚫
违规Action检测
禁止Use右键菜单
⚠️ 此Action已被系统记录
1

集合加法

📝 Solutions 🔵 仅限 C++
Problems Description
<span style="color:#231F17;font-family:'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, sans-serif;font-size:14px;line-height:21px;">给出2items正整数集合A = {p</span><sub>i</sub><span style="color:#231F17;font-family:'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, sans-serif;font-size:14px;line-height:21px;">&nbsp;| 1 &lt;= i &lt;= a},B = {q</span><sub>j</sub><span style="color:#231F17;font-family:'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, sans-serif;font-size:14px;line-height:21px;">&nbsp;| 1 &lt;= j &lt;= b}和一items正整数s。问题是:使得p</span><sub>i</sub><span style="color:#231F17;font-family:'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, sans-serif;font-size:14px;line-height:21px;">+ q</span><sub>j</sub><span style="color:#231F17;font-family:'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, sans-serif;font-size:14px;line-height:21px;">&nbsp;= s的不同的(i, j)对有多少items。</span>
Input格式
<span style="color:#231F17;font-family:'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, sans-serif;font-size:14px;line-height:21px;">Page 1行是测试数据的组数n,后面跟着n组测试数据。</span><br /> <br /> <span style="color:#231F17;font-family:'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, sans-serif;font-size:14px;line-height:21px;">每组测试数据占5行,Page 1行是和s (1 &lt;= s &lt;= 10000),Page 2行是一items正整数a (1 &lt;= a &lt;= 10000),表示A中元素的数目。Page 3行是aitems正整数,每items正整数不超过10000,表示A中的元素。Page 4行是一items正整数b (1 &lt;= b &lt;= 10000),表示B中元素的数目。Page 5行是bitems正整数,每items正整数不超过10000,表示B中的元素。</span><br /> <br /> <span style="color:#231F17;font-family:'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, sans-serif;font-size:14px;line-height:21px;">注意:这里的集合和数学书上定义的集合有一点点区别——集合内可能包含相等的正整数。</span>
Output格式
<span style="color:#231F17;font-family:'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, sans-serif;font-size:14px;line-height:21px;">n行,每行输出对应一items输入。输出应是一items非负整数。</span>
Sample
Sample Input 1
2 99 2 49 49 2 50 50 11 9 1 2 3 4 5 6 7 8 9 10 10 9 8 7 6 5 4 3 2 1
Sample Output 1
4 9
Submit Code
请先Login后Submit

🤖 AI 解题助手

OpenRouter
就绪
👋 你好!我是 AI 解题助手。
我已阅读了这problems题,可以帮你points析思路、提供Code示例。
🔓 完全Free · 无需消耗 Token