码迷,mamicode.com
首页 > 其他好文 > 详细

CF916C Jamie and Interesting Graph

时间:2018-01-22 17:36:45      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:namespace   post   break   构造   for   log   pre   pos   name   

思路:
构造

实现:

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 int main()
 4 {
 5     int n, m;
 6     cin >> n >> m;
 7     cout << "100003 100003" << endl;
 8     for (int i = 0; i < n - 2; i++)
 9     {
10         cout << i + 1 << " " << i + 2 << " " << 1 << endl;
11     }
12     cout << n - 1 << " " << n << " " << 100005 - n << endl;
13     int cnt = 0;
14     for (int i = 1; i <= n; i++)
15     {
16         for (int j = i + 2; j <= n; j++)
17         {
18             if (cnt >= m - n + 1) break;
19             cout << i << " " << j << " 1000000000" << endl;
20             cnt++;
21         }
22     }
23     return 0;
24 }

 

CF916C Jamie and Interesting Graph

标签:namespace   post   break   构造   for   log   pre   pos   name   

原文地址:https://www.cnblogs.com/wangyiming/p/8329523.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!