2019年2月27日

UVA - 725 Division

摘要: #include using namespace std; int main() { int n; bool first = true; while(cin >> n && n){ if(first){ first = false; }else printf("\n"); b... 阅读全文

posted @ 2019-02-27 20:59 nbsanshi 阅读(108) 评论(0) 推荐(0) 编辑

UVA - 10976 Fractions Again?!

摘要: #include using namespace std; typedef pairPair; int main() { int k; while(cin >> k){ int cnt = 0; vectorans; for(int y = k + 1; y <= 2*k; y++){ if(y*k % ... 阅读全文

posted @ 2019-02-27 20:58 nbsanshi 阅读(73) 评论(0) 推荐(0) 编辑

UVA - 524 Prime Ring Problem

摘要: #include using namespace std; typedef pairPair; int n; bool is_prime(int x) { for(int i = 2; i > n){ if(first){ first = false; }else cout << endl; ... 阅读全文

posted @ 2019-02-27 20:57 nbsanshi 阅读(78) 评论(0) 推荐(0) 编辑

uva1599 Ideal path(已AC)

摘要: 本题昨晚和一个大佬讨论了一下,有了一个初步的解决方案,但是今天下午实现的时候发现仍有bug。 完整的思路为: 1. d数组为反向dfs获得的新图的结构。即在新图中,u的下一个结点为v需满足,d[v] == d[u] - 1。 2. 新图为有向无环图。 3. 问题转化为:有一个DAG,边有权,给定起点 阅读全文

posted @ 2019-02-27 19:33 nbsanshi 阅读(106) 评论(0) 推荐(0) 编辑

导航