1014 - Ifter Party

IfterParty食物分配问题
本文介绍了一个关于食物分配的问题,即如何计算每位参赛者在IfterParty上吃了多少个piaju。通过输入派对准备的食物总数和剩余数量,程序能够找出符合条件的分配方案,并按升序输出可能的数量。
1014 - Ifter Party
Time Limit: 2 second(s)Memory Limit: 32 MB

I have an Ifter party at the 5th day of Ramadan for the contestants. For this reason I have invited C contestants and arranged P piaju's (some kind of food, specially made for Ifter). Each contestant ate Q piaju's and L piaju's were left (L < Q).

Now you have to find the number of piaju's each contestant ate.

Input

Input starts with an integer T (≤ 325), denoting the number of test cases.

Each case contains two non-negative integers P and L (0 ≤ L < P < 231).

Output

For each case, print the case number and the number of possible integers in ascending order. If no such integer is found print 'impossible'.

Sample Input

Output for Sample Input

4

10 0

13 2

300 98

1000 997

Case 1: 1 2 5 10

Case 2: 11

Case 3: 101 202

Case 4: impossible

 


SPECIAL THANKS: JANE ALAM JAN (DESCRIPTION, SOLUTION, DATASET)

求p-l大于l的因子

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <string>
#include <iostream>
#include <vector>
#define LL long long
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
const int maxn=1<<30;
const int SIZE=1e5+10;
set<int>st;
void get_fac(int x,int l){
    st.clear();
    for(int i=1;i<=(int)sqrt((double)x);i++){
        if(x%i==0){
            if(i>l)st.insert(i);
            if(x/i>l)st.insert(x/i);
        }
    }
}
int main()
{
    int T,x;
    scanf("%d",&T);
    for(int cas=1;cas<=T;cas++){
        int p,l;
        scanf("%d%d",&p,&l);
        x=p-l;
        get_fac(x,l);
        printf("Case %d: ",cas);
        if(st.empty()){
            printf("impossible\n");
            continue;
        }
        set<int>::iterator it=st.begin();
        printf("%d",*it);
        for(it++;it!=st.end();it++){
            printf(" %d",*it);
        }
        printf("\n");
    }
    return 0;
}


set APPL=230429 set CoordName=LamCon_40N_97W set GridName=2023_04SE1 set CMAQ_HOME = /student/home/wsj123/1/CMAQ set DataPath = /student/home/wsj123/1/CMAQ/data set InMetDir = /student/home/wsj123/1/CMAQ/wrfout set IfGeo = T set InGeoDir = /student/home/wsj123/1/CMAQ/wps_geo set InGeoFile = ( /student/home/wsj123/1/CMAQ/wps_geo/geo_em.d01.nc ) set OutDir = /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/output set ProgDir = /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/src set WorkDir = /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/output set InMetFiles = ( /student/home/wsj123/1/CMAQ/wrfout/wrfout_d01_2023-04-09_00:00:00.nc /student/home/wsj123/1/CMAQ/wrfout/wrfout_d02_2023-04-09_00:00:00.nc /student/home/wsj123/1/CMAQ/wrfout/wrfout_d03_2023-04-09_00:00:00.nc ) set LPV = 1 set LWOUT = 0 set LUVBOUT = 1 set IfTer = T set MCIP_START = 2023-04-09-00:00:00.0000 set MCIP_END = 2023-04-14-21:00:00.0000 set INTVL = 60 set IOFORM = 1 set BTRIM = 0 set X0 = 13 set Y0 = 94 set NCOLS = 89 set NROWS = 104 set LPRT_COL = 0 set LPRT_ROW = 0 set WRF_LC_REF_LAT = 40.0 setenv EXECUTION_ID MCIP_RUN_230429 set PROG = mcip date Thu May 29 20:44:36 CST 2025 mkdir -p /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/output if ( 0 != 0 ) then foreach dir ( /student/home/wsj123/1/CMAQ/wrfout /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/src /student/home/wsj123/1/CMAQ/wps_geo ) if ( ! -d /student/home/wsj123/1/CMAQ/wrfout ) then end if ( ! -d /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/src ) then end if ( ! -d /student/home/wsj123/1/CMAQ/wps_geo ) then end if ( T == T ) then if ( ! -f /student/home/wsj123/1/CMAQ/wps_geo/geo_em.d01.nc ) then endif foreach fil ( /student/home/wsj123/1/CMAQ/wrfout/wrfout_d01_2023-04-09_00:00:00.nc /student/home/wsj123/1/CMAQ/wrfout/wrfout_d02_2023-04-09_00:00:00.nc /student/home/wsj123/1/CMAQ/wrfout/wrfout_d03_2023-04-09_00:00:00.nc ) if ( ! -f /student/home/wsj123/1/CMAQ/wrfout/wrfout_d01_2023-04-09_00:00:00.nc ) then end if ( ! -f /student/home/wsj123/1/CMAQ/wrfout/wrfout_d02_2023-04-09_00:00:00.nc ) then end if ( ! -f /student/home/wsj123/1/CMAQ/wrfout/wrfout_d03_2023-04-09_00:00:00.nc ) then end if ( ! -f /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/src/mcip.exe ) then cd /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/output if ( T == T ) then set InGeo = /student/home/wsj123/1/CMAQ/wps_geo/geo_em.d01.nc else set FILE_GD = /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/output/GRIDDESC cat echo Generated namelist: Generated namelist: cat /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/output/namelist.mcip &FILENAMES file_gd = '/student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/output/GRIDDESC' file_mm = '/student/home/wsj123/1/CMAQ/wrfout/wrfout_d01_2023-04-09_00:00:00.nc', '/student/home/wsj123/1/CMAQ/wrfout/wrfout_d02_2023-04-09_00:00:00.nc', '/student/home/wsj123/1/CMAQ/wrfout/wrfout_d03_2023-04-09_00:00:00.nc' geo_file = '/student/home/wsj123/1/CMAQ/wps_geo/geo_em.d01.nc' / &CONTROL LPV = 1, LWOUT = 0, LUVBOUT = 1, MCIP_START = '2023-04-09-00:00:00.0000', MCIP_END = '2023-04-14-21:00:00.0000', INTVL = 60, IOFORM = 1, BTRIM = 0, X0 = 13, Y0 = 94, NCOLS = 89, NROWS = 104, LPRT_COL = 0, LPRT_ROW = 0, WRF_LC_REF_LAT = 40.0 / echo echo Running MCIP... Running MCIP... /student/home/wsj123/1/CMAQ/cmaq5.3.1/CMAQ-CMAQv5.3.1_19Dec2019/PREP/mcip/src/mcip.exe This program uses the EPA-AREAL/MCNC-EnvPgms/BAMS Models-3 I/O Applications Programming Interface, [I/O API] which is built on top of the netCDF I/O library (Copyright 1993, 1996 University Corporation for Atmospheric Research/Unidata Program) and the PVM parallel-programming library (from Oak Ridge National Laboratory). Copyright (C) 1992-2002 MCNC, (C) 1992-2018 Carlie J. Coats, Jr., (C) 2003-2012 Baron Advanced Meteorological Systems, LLC, and (C) 2014-2020 UNC Institute for the Environment. Released under the GNU LGPL License, version 2.1. See URL https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for conditions of use. ioapi-3.2: $Id: init3.F90 150 2020-04-11 17:51:44Z coats $ Version with PARMS3.EXT/PARAMETER::MXVARS3= 2048 netCDF version 4.7.0 of Apr 21 2025 17:04:57 $ EXECUTION_ID: MCIP_RUN_230429 ============================================================================== US EPA COMMUNITY MULTISCALE AIR QUALITY MODEL METEOROLOGY-CHEMISTRY INTERFACE PROCESSOR MCIP V5.1 FROZEN 11/21/2019 ============================================================================== ********************************************************************** *** SUBROUTINE: READNML *** ERROR READING NAMELIST FILE ON UNIT 8 *** NAMELIST FILE NAME = namelist.mcip *** NAMELIST = filenames *** IOSTAT = 19 ********************************************************************** *** ERROR ABORT in subroutine READNML ABNORMAL TERMINATION IN READNML if ( 103 != 0 ) then echo MCIP execution failed with status 0 MCIP execution failed with status 0 exit 1
05-30
(1)普通用户端(全平台) 音乐播放核心体验: 个性化首页:基于 “听歌历史 + 收藏偏好” 展示 “推荐歌单(每日 30 首)、新歌速递、相似曲风推荐”,支持按 “场景(通勤 / 学习 / 运动)” 切换推荐维度。 播放页功能:支持 “无损音质切换、倍速播放(0.5x-2.0x)、定时关闭、歌词逐句滚动”,提供 “沉浸式全屏模式”(隐藏冗余控件,突出歌词与专辑封面)。 多端同步:自动同步 “播放进度、收藏列表、歌单” 至所有登录设备(如手机暂停后,电脑端打开可继续播放)。 音乐发现与管理: 智能搜索:支持 “歌曲名 / 歌手 / 歌词片段” 搜索,提供 “模糊匹配(如输入‘晴天’联想‘周杰伦 - 晴天’)、热门搜索词推荐”,结果按 “热度 / 匹配度” 排序。 歌单管理:创建 “公开 / 私有 / 加密” 歌单,支持 “批量添加歌曲、拖拽排序、一键分享到社交平台”,系统自动生成 “歌单封面(基于歌曲风格配色)”。 音乐分类浏览:按 “曲风(流行 / 摇滚 / 古典)、语言(国语 / 英语 / 日语)、年代(80 后经典 / 2023 新歌)” 分层浏览,每个分类页展示 “TOP50 榜单”。 社交互动功能: 动态广场:查看 “关注的用户 / 音乐人发布的动态(如‘分享新歌感受’)、好友正在听的歌曲”,支持 “点赞 / 评论 / 转发”,可直接点击动态中的歌曲播放。 听歌排行:个人页展示 “本周听歌 TOP10、累计听歌时长”,平台定期生成 “全球 / 好友榜”(如 “好友中你本周听歌时长排名第 3”)。 音乐圈:加入 “特定曲风圈子(如‘古典音乐爱好者’)”,参与 “话题讨论(如‘你心中最经典的钢琴曲’)、线上歌单共创”。 (2)音乐人端(创作者中心) 作品管理: 音乐上传:支持 “无损音频(FLAC/WAV)+ 歌词文件(LRC)+ 专辑封面” 上传,填写 “歌曲信息
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值