JAVA-p257 T7.17

import java.util.Scanner;
public class HelloWorld{
public static void main(String[] args){
		Scanner input= new Scanner(System.in);
		int n=input.nextInt();               //确定银行数目
		int limit=input.nextInt();			 //确定最低限额
		int[] k=new int[n];					 //标记
		double[][] borrowers=new double[n][n]; //借款金额
		double[] sum=new double[n];       //总金额
		for (int i=0;i<n;i++)
		{
			sum[i]=input.nextDouble();     //先输入剩余金额
			int j=input.nextInt(); 				//输入向这家银行贷款的银行数目
			while (j!=0)
			{
				int num=input.nextInt();		//输入贷款银行的行号
				borrowers[i][num]=input.nextDouble(); //确定贷款银行向这家银行贷款的金额数目。
				j--;
			}
		}
		for (int i=0;i<n;i++)
		{
			for (int j=0;j<n;j++)
			{
				sum[i] += borrowers[i][j];  //确认总资产
				
			}
			System.out.println(sum[i] );
		}		
		while (true)
		{
			for (int i=0;i<n;i++)		//扫描所有银行
			{
				if (sum[i]<limit)                //如果该家银行总资产低于限制线201
				{
					for (int j=0;j<n;j++)
					{	
						sum[j]-=borrowers[j][i];  //这家银行向其他银行贷的款清0且其他银行的总资产要减去这部分贷款
						borrowers[j][i]=0;
					}
					k[i]=1;      //不安全的银行标记为1
				}
			}
			int counts=0;    //申明计数器并重置为0
			for (int i=0;i<n;i++)				//扫描所有银行
			{
				if (sum[i]>limit||k[i]==1)  //如果当前银行总金额超过限制线或者已经确认为不安全的银行
					counts++;					//计数器+1
			}
			if (counts==n)						//如果计数器数值与银行数目相当,则说明已经找到所有的不安全银行
				break;							//跳出
		}
		System.out.print("Unsafe banks are");
		for (int i=0;i<n;i++)
		{
			if (sum[i]<limit)
			{
				System.out.print(" " + i);               //输出不安全的银行行号
			}
		}

	}
}


 

 

 

运行结果:

还是报错ity.", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "deprecation.elasticsearch", "timestamp": "2025-07-16T08:40:58,408Z", "level": "CRITICAL", "component": "o.e.d.x.s.s.SecurityStatusChangeListener", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "The default behavior of disabling security on basic licenses is deprecated. In a later version of Elasticsearch, the value of [xpack.security.enabled] will default to \"true\" , regardless of the license level. See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-minimal-setup.html to enable security, or explicitly disable security by setting [xpack.security.enabled] to false in elasticsearch.yml", "key": "security_implicitly_disabled", "category": "security", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:02,680Z", "level": "INFO", "component": "o.e.c.m.MetadataCreateIndexService", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "[.ds-.logs-deprecation.elasticsearch-default-2025.07.16-000001] creating index, cause [initialize_data_stream], templates [.deprecation-indexing-template], shards [1]/[1]", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:02,695Z", "level": "INFO", "component": "o.e.c.r.a.AllocationService", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "updating number_of_replicas to [0] for indices [.ds-.logs-deprecation.elasticsearch-default-2025.07.16-000001]", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:02,711Z", "level": "INFO", "component": "o.e.c.m.MetadataCreateDataStreamService", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "adding data stream [.logs-deprecation.elasticsearch-default] with write index [.ds-.logs-deprecation.elasticsearch-default-2025.07.16-000001], backing indices [], and aliases []", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:02,814Z", "level": "INFO", "component": "o.e.x.i.IndexLifecycleTransition", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "moving index [.ds-.logs-deprecation.elasticsearch-default-2025.07.16-000001] from [null] to [{\"phase\":\"new\",\"action\":\"complete\",\"name\":\"complete\"}] in policy [.deprecation-indexing-ilm-policy]", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:02,862Z", "level": "INFO", "component": "o.e.x.i.IndexLifecycleTransition", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "moving index [.ds-.logs-deprecation.elasticsearch-default-2025.07.16-000001] from [{\"phase\":\"new\",\"action\":\"complete\",\"name\":\"complete\"}] to [{\"phase\":\"hot\",\"action\":\"unfollow\",\"name\":\"branch-check-unfollow-prerequisites\"}] in policy [.deprecation-indexing-ilm-policy]", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:02,894Z", "level": "INFO", "component": "o.e.x.i.IndexLifecycleTransition", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "moving index [.ds-.logs-deprecation.elasticsearch-default-2025.07.16-000001] from [{\"phase\":\"hot\",\"action\":\"unfollow\",\"name\":\"branch-check-unfollow-prerequisites\"}] to [{\"phase\":\"hot\",\"action\":\"rollover\",\"name\":\"check-rollover-ready\"}] in policy [.deprecation-indexing-ilm-policy]", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:02,931Z", "level": "INFO", "component": "o.e.c.r.a.AllocationService", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.ds-.logs-deprecation.elasticsearch-default-2025.07.16-000001][0]]]).", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:03,034Z", "level": "INFO", "component": "o.e.c.m.MetadataMappingService", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "[.ds-.logs-deprecation.elasticsearch-default-2025.07.16-000001/JsTb5E1sRIOiz3sY3tW0kQ] update_mapping [_doc]", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:07,882Z", "level": "INFO", "component": "o.e.c.m.MetadataCreateIndexService", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "[.ds-ilm-history-5-2025.07.16-000001] creating index, cause [initialize_data_stream], templates [ilm-history], shards [1]/[0]", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:07,885Z", "level": "INFO", "component": "o.e.c.m.MetadataCreateDataStreamService", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "adding data stream [ilm-history-5] with write index [.ds-ilm-history-5-2025.07.16-000001], backing indices [], and aliases []", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:07,947Z", "level": "INFO", "component": "o.e.x.i.IndexLifecycleTransition", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "moving index [.ds-ilm-history-5-2025.07.16-000001] from [null] to [{\"phase\":\"new\",\"action\":\"complete\",\"name\":\"complete\"}] in policy [ilm-history-ilm-policy]", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:07,985Z", "level": "INFO", "component": "o.e.c.r.a.AllocationService", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.ds-ilm-history-5-2025.07.16-000001][0]]]).", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:08,016Z", "level": "INFO", "component": "o.e.x.i.IndexLifecycleTransition", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "moving index [.ds-ilm-history-5-2025.07.16-000001] from [{\"phase\":\"new\",\"action\":\"complete\",\"name\":\"complete\"}] to [{\"phase\":\"hot\",\"action\":\"unfollow\",\"name\":\"branch-check-unfollow-prerequisites\"}] in policy [ilm-history-ilm-policy]", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:08,049Z", "level": "INFO", "component": "o.e.x.i.IndexLifecycleTransition", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "moving index [.ds-ilm-history-5-2025.07.16-000001] from [{\"phase\":\"hot\",\"action\":\"unfollow\",\"name\":\"branch-check-unfollow-prerequisites\"}] to [{\"phase\":\"hot\",\"action\":\"rollover\",\"name\":\"check-rollover-ready\"}] in policy [ilm-history-ilm-policy]", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" } {"type": "server", "timestamp": "2025-07-16T08:41:08,346Z", "level": "ERROR", "component": "o.e.i.g.GeoIpDownloader", "cluster.name": "docker-cluster", "node.name": "d159dda0e54d", "message": "exception during geoip databases update", "cluster.uuid": "g0-4_sPkTYKzBSiHMkI5JA", "node.id": "lzOtT8kCQ9iTr8ImYmKEyQ" , "stacktrace": ["java.net.SocketTimeoutException: Connect timed out", "at sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:539) ~[?:?]", "at sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:585) ~[?:?]", "at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[?:?]", "at java.net.Socket.connect(Socket.java:666) ~[?:?]", "at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:304) ~[?:?]", "at sun.net.NetworkClient.doConnect(NetworkClient.java:178) ~[?:?]", "at sun.net.www.http.HttpClient.openServer(HttpClient.java:532) ~[?:?]", "at sun.net.www.http.HttpClient.openServer(HttpClient.java:637) ~[?:?]", "at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) ~[?:?]", "at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:378) ~[?:?]", "at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:193) ~[?:?]", "at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1241) ~[?:?]", "at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1127) ~[?:?]", "at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:179) ~[?:?]", "at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1657) ~[?:?]", "at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1581) ~[?:?]", "at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:529) ~[?:?]", "at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:308) ~[?:?]", "at org.elasticsearch.ingest.geoip.HttpClient.lambda$get$0(HttpClient.java:55) ~[ingest-geoip-7.17.10.jar:7.17.10]", "at java.security.AccessController.doPrivileged(AccessController.java:571) ~[?:?]", "at org.elasticsearch.ingest.geoip.HttpClient.doPrivileged(HttpClient.java:97) ~[ingest-geoip-7.17.10.jar:7.17.10]", "at org.elasticsearch.ingest.geoip.HttpClient.get(HttpClient.java:49) ~[ingest-geoip-7.17.10.jar:7.17.10]", "at org.elasticsearch.ingest.geoip.HttpClient.getBytes(HttpClient.java:40) ~[ingest-geoip-7.17.10.jar:7.17.10]", "at org.elasticsearch.ingest.geoip.GeoIpDownloader.fetchDatabasesOverview(GeoIpDownloader.java:159) ~[ingest-geoip-7.17.10.jar:7.17.10]", "at org.elasticsearch.ingest.geoip.GeoIpDownloader.updateDatabases(GeoIpDownloader.java:147) ~[ingest-geoip-7.17.10.jar:7.17.10]", "at org.elasticsearch.ingest.geoip.GeoIpDownloader.runDownloader(GeoIpDownloader.java:284) [ingest-geoip-7.17.10.jar:7.17.10]", "at org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor.nodeOperation(GeoIpDownloaderTaskExecutor.java:100) [ingest-geoip-7.17.10.jar:7.17.10]", "at org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor.nodeOperation(GeoIpDownloaderTaskExecutor.java:46) [ingest-geoip-7.17.10.jar:7.17.10]", "at org.elasticsearch.persistent.NodePersistentTasksExecutor$1.doRun(NodePersistentTasksExecutor.java:42) [elasticsearch-7.17.10.jar:7.17.10]", "at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:777) [elasticsearch-7.17.10.jar:7.17.10]", "at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) [elasticsearch-7.17.10.jar:7.17.10]", "at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) [?:?]", "at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) [?:?]", "at java.lang.Thread.run(Thread.java:1623) [?:?]"] }用了这个命令podman run -d \ --name elasticsearch \ --network janus-net \ -p 9200:9200 \ -p 9300:9300 \ -e "discovery.type=single-node" \ -e "ES_SECURITY_ENABLE=true" \ -e "ELASTIC_PASSWORD=iaas@123" \ -v /opt/geoip:/usr/share/elasticsearch/config/elasticsearch/geoip \ docker.io/library/elasticsearch:7.17.10 中这个GeoLite2-City.mmdb文件已下载
最新发布
07-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值