billionaire双色球选号器

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
void main()
{
 int i,j,c;
 char ch;
 system("cls");
 puts("");
 printf("/t/t  l----欢迎使用  亿万富翁  双色球选号器----l/n");
 printf("/t/t  l                                        l/n");
 printf("/t/t  l                                        l/n");
 printf("/t/t  l            中奖500万不是梦             l/n");
 printf("/t/t  l                                        l/n");
 printf("/t/t  l          亿万富翁帮您选彩票,           l/n");
 printf("/t/t  l                                        l/n");
 printf("/t/t  l          让您乐得硬睡不着觉.           l/n");
 printf("/t/t  l                                        l/n");
 printf("/t/t  l          亿万富翁让您中大奖,           l/n");
 printf("/t/t  l                                        l/n");
 printf("/t/t  l          让您轻轻松松把福享.           l/n");
 printf("/t/t  l                                        l/n"); 
 printf("/t/t  l                                        l/n");
 printf("/t/t  l           娱乐软件 仅供参考            l/n");
 printf("/t/t  l           版权所有 违者必究            l/n");
 printf("/t/t  l                                        l/n");
 printf("/t/t  l        按Y开始选号,按N退出运行         l/n");
 printf("/t/t  l                                        l/n");
 printf("/t/t  l----------------------------------------l/n");
 printf("/n/t/t/t     请按键Y/N进入操作:");
 scanf(" %c",&ch);
 if(ch=='N'||ch=='n') c=0;
 else c=1;
 system("cls");
 //randomize();
 srand(time(NULL));
 while(c==1)
 { printf("/n/n/t    普通号码:");
   for(i=0,j=24000;i++<j--;)
    if((i!=0)&&(i%2000==0))
     printf("%-02d   ",rand()%33+1);
   printf("特别号码:%-02d",rand()%33+1);
  printf("/n/n/n/n/t/t/tContinue or Exit(B/Y/N):");
  scanf(" %c",&ch);
  if(ch=='N'||ch=='n') c=0;
  else if(ch=='B'||ch=='b') {main();c=0;}
  else c=1;
  system("cls");
 }
 return 0;
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
import java.util.*;public class Billionaires { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Map<String, List<Billionaire>> billionairesByCity = new HashMap<>(); for (int i = 0; i < n; i++) { String name = sc.next(); String city = sc.next(); long fortune = sc.nextLong(); Billionaire billionaire = new Billionaire(name, city, fortune); if (!billionairesByCity.containsKey(city)) { billionairesByCity.put(city, new ArrayList<>()); } billionairesByCity.get(city).add(billionaire); } int m = sc.nextInt(); int k = sc.nextInt(); for (int i = 0; i < k; i++) { int day = sc.nextInt(); String name = sc.next(); String city = sc.next(); List<Billionaire> billionaires = billionairesByCity.get(city); for (Billionaire billionaire : billionaires) { if (billionaire.name.equals(name)) { billionaire.addTravel(day); break; } } } List<String> cities = new ArrayList<>(billionairesByCity.keySet()); Collections.sort(cities); for (String city : cities) { List<Billionaire> billionaires = billionairesByCity.get(city); Map<Integer, Long> wealthByDay = new HashMap<>(); for (Billionaire billionaire : billionaires) { for (int day : billionaire.travels) { wealthByDay.put(day, wealthByDay.getOrDefault(day, 0L) + billionaire.fortune); } } int maxDays = 0; for (int day : wealthByDay.keySet()) { long wealth = wealthByDay.get(day); for (int i = day + 1; i <= m; i++) { long futureWealth = wealthByDay.getOrDefault(i, 0L); if (futureWealth > wealth) { break; } if (i - day > maxDays) { maxDays = i - day; } } } if (maxDays > 0) { System.out.println(city + " " + maxDays); } } } static class Billionaire { String name; String city; long fortune; List<Integer> travels = new ArrayList<>(); public Billionaire(String name, String city, long fortune) { this.name = name; this.city = city; this.fortune = fortune; } public void addTravel(int day) { travels.add(day); } }}的计算复杂度是多少
05-30

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值