<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Codeforces Round #594 (Div. 2) A. Integer Points 水題

      A. Integer Points

      DLS and JLS are bored with a Math lesson. In order to entertain themselves, DLS took a sheet of paper and drew ?? distinct lines, given by equations ??=??+???? for some distinct ??1,??2,…,????.

      Then JLS drew on the same paper sheet ?? distinct lines given by equations ??=???+???? for some distinct ??1,??2,…,????.

      DLS and JLS are interested in counting how many line pairs have integer intersection points, i.e. points with both coordinates that are integers. Unfortunately, the lesson will end up soon, so DLS and JLS are asking for your help.

      Input

      The first line contains one integer ?? (1≤??≤1000), the number of test cases in the input. Then follow the test case descriptions.

      The first line of a test case contains an integer ?? (1≤??≤105), the number of lines drawn by DLS.

      The second line of a test case contains ?? distinct integers ???? (0≤????≤109) describing the lines drawn by DLS. The integer ???? describes a line given by the equation ??=??+????.

      The third line of a test case contains an integer ?? (1≤??≤105), the number of lines drawn by JLS.

      The fourth line of a test case contains ?? distinct integers ???? (0≤????≤109) describing the lines drawn by JLS. The integer ???? describes a line given by the equation ??=???+????.

      The sum of the values of ?? over all test cases in the input does not exceed 105. Similarly, the sum of the values of ?? over all test cases in the input does not exceed 105.

      In hacks it is allowed to use only one test case in the input, so ??=1 should be satisfied.

      Output

      For each test case in the input print a single integer — the number of line pairs with integer intersection points.

      Example

      input
      3
      3
      1 3 2
      2
      0 3
      1
      1
      1
      1
      1
      2
      1
      1
      output
      3
      1
      0

      Note

      The picture shows the lines from the first test case of the example. Black circles denote intersection points with integer coordinates.

      題意

      一個二維平面,有兩種線,一種是y=x+p[i],一種是y=-x+q[i],問你這兩種直線相交后,有多少個整數交點。

      題解

      我們解出來相交點為 x = (p[i]+q[i])/2,那么只要同奇偶,就是整數交點

      代碼

      #include<bits/stdc++.h>
      using namespace std;
      const int maxn = 100005;
      int p[maxn],q[maxn],n,m;
      void solve(){
      	vector<int>cnt1(2,0),cnt2(2,0);
      	scanf("%d",&n);
      	for(int i=0;i<n;i++){
      		scanf("%d",&p[i]);
      		cnt1[p[i]%2]++;
      	}
      	scanf("%d",&m);
      	for(int i=0;i<m;i++){
      		scanf("%d",&q[i]);
      		cnt2[q[i]%2]++;
      	}
      	cout<<1ll*cnt1[0]*cnt2[0]+1ll*cnt1[1]*cnt2[1]<<endl;
      
      }
      int main(){
      	int t;
      	scanf("%d",&t);
      	while(t--){
      		solve();
      	}
      }
      
      posted @ 2019-11-12 15:35  qscqesze  閱讀(345)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 欧美va亚洲va在线观看| 国产精品色三级在线观看| 国产精品视频不卡一区二区| 国产SM重味一区二区三区| 一区二区国产精品精华液| 亚洲午夜精品久久久久久抢| 久久国产精品精品国产色婷婷| 亚洲人成小说网站色在线| 国产果冻豆传媒麻婆| 国产精品白丝久久AV网站| 风流老熟女一区二区三区| 亚洲欧美中文日韩V日本| 西华县| 18禁无遮拦无码国产在线播放| 漂亮的人妻不敢呻吟被中出| 国产日韩另类综合11页| 国产亚洲精品中文字幕| 国产超碰人人爽人人做人人添| 久久亚洲精品无码播放| 无码人妻精品一区二区在线视频| 美女人妻激情乱人伦| 精品视频一区二区三区不卡| 欧美肥老太交视频免费| 国产不卡免费一区二区| 亚欧美闷骚院| 久久久噜噜噜久久| 芜湖县| 国产一区二区三区我不卡| 亚洲国产午夜福利精品| 午夜成人无码福利免费视频| 久久精品国产午夜福利伦理| 人妻蜜臀久久av不卡| 麻豆人人妻人人妻人人片av| 中文字幕乱码熟妇五十中出| 日韩在线观看 一区二区| 狠狠色噜噜狠狠狠狠av不卡| 久久成人国产精品免费软件| 一级片黄色一区二区三区| 91无码人妻精品一区二区蜜桃 | 国产精品人成视频免费播放| 中文熟妇人妻av在线|