HW7.17

 1 import java.util.Scanner;
 2
 3 public class Solution
 4 {
 5     public static void main(String[] args)
 6     {
 7         Scanner input = new Scanner(System.in);
 8
 9         int n = input.nextInt();
10         int limit = input.nextInt();
11
12         int[][] borrowers = new int[n][n];
13
14         for(int i = 0; i < n; i++)
15         {
16             borrowers[i][i] = input.nextInt();
17             int volume = input.nextInt();
18             int[] temp = new int[volume * 2];
19             for(int j = 0; j < temp.length; j++)
20                 temp[j] = input.nextInt();
21             for(int j = 1; j < temp.length; j += 2)
22                 borrowers[i][temp[j - 1]] = temp[j];
23         }
24
25         boolean existChange = false;
26         while(true)
27         {
28             existChange = false;
29             for(int i = 0; i < n; i++)
30             {
31                 int sum = 0;
32                 for(int j = 0; j < n; j++)
33                     sum += borrowers[i][j];
34                 if(sum < limit)
35                 {
36                     System.out.println("Unsafe Bank -- " + i);
37                     existChange = true;
38                     for(int j = 0; j < n; j++)
39                         if(j != i)
40                             borrowers[j][i] = 0;
41                 }
42             }
43             if(existChange == false)
44                 break;
45         }
46     }
47 }
时间: 2024-08-06 03:42:45

HW7.17的相关文章

AnimeGAN输出日志

D:\MyFiles\LearnFiles\Code\Python\AnimeGAN\AnimeGAN>python main.py --phase train --dataset Hayao --epoch 1 --init_epoch 1D:\Users\feng_\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning:

[c/c++] programming之路(17)、高级指针

一.二级指针 二级指针的作用:1.函数改变外部变量指针2.外挂改变一个指针的值 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 void main(){ 5 int a = 10; 6 int b = 20; 7 int *p1 = &a; 8 int *p2 = &b; 9 int **pp = &p1; 10 printf("%d,", **pp); 11 printf("\n%x,

java核心技术 - 17个重要的知识点

1.Java中没有多继承,而是用接口来代替多继承 2.运行一个已经编译的程序时,Java解释器总是从指定类的main方法中的代码开始执行,因此,执行代码中必须有一个main函数. 3.Java是典型的强类型语言,即必须声明变量的类型,Java中有8种类型,6种数值类型(4个整数型和2个浮点型).一个字符类型和一个boolean类型. 想学习java可以来这个群,首先是二二零,中间是一四二,最后是九零六,里面有大量的学习资料可以下载. 4.强制类型转换: int nx = (int) x; //

Up to 8% free bonus for runescape 2007 gp on Rsorder as july best gift&Enjoy Telos During 7.1-7.22

Now, a small band of freedom fighters struggle to end the osrs gold  long, dark night of Daein's oppression. The big blog news of the day is that Vox Media has acquired Curbed Network. As an amulet you should be wearing an amulet of glory and if you

PSP(5.11——5.17)以及周记录

1.PSP 5.11 14:30 20:00 130 200 Cordova A Y min 5.12 9:00 14:00 100 200 Cordova A Y min 5.13 13:30 15:00 20 70 软件项目管理课 A Y min 19:00 20:00 20 40 Cordova A Y min 5.17 11:00 19:00 240 240 Cordova A Y min 2.PSP分类统计以及圆饼图 分类 A B C D 时间总计 750 0  0 0     3.周

TControl的消息覆盖函数大全(15个WM_函数和17个CM_函数,它的WndProc就处理鼠标与键盘消息)

注意,这些函数只有Private一种形式(也就是不允许覆盖,但仍在动态表格中): TControl = class(TComponent) private // 15个私有消息处理,大多是鼠标消息.注意,消息函数大多只是一个中介,且TWinControl并不重写. procedure WMNCLButtonDown(var Message: TWMNCLButtonDown); message WM_NCLBUTTONDOWN; procedure WMLButtonDown(var Messa

【面试题17】合并两个排序的链表

[题目描述] 输入两个递增排序的链表,合并这两个链表并使新链表中的结点是按照递增排序的. [解决方案] 用递归解决,非常简单. 我的代码实现,仅供参考: 1 public static ListNode Merge(ListNode listA, ListNode listB) 2 { 3 if (listA == null) 4 { 5 return listB; 6 } 7 else if(listB == null) 8 { 9 return listA; 10 } 11 12 ListN

Leetcode -- Day 17

substring Question 1 Implement strStr() Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Below is my first direct solution, which looks complex in different case checking us

17.如何自学Struts2之Struts2 Annotation注释[视频]

17.如何自学Struts2之Struts2 Annotation注释[视频] 之前写了一篇"打算做一个视频教程探讨如何自学计算机相关的技术",优酷上传不了,只好传到百度云上: http://pan.baidu.com/s/1kTDsa95 有问题可以直接回复这篇文章.