F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Substring

Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 122768/62768 K (Java/Others)
Total Submission(s): 1286    Accepted Submission(s): 381


Problem Description
Give you two number a, b. Output the smallest number that can be added to a to contain the number b as a substring.
 

Input
The first line contains a single positive integer T( T <= 500 ), indicates the number of test cases.
For each test case: Two number a,b;
  0 <= a <= 10^100, 0 <= b <= 10^7
 

Output
For each test case: output the case number as shown and the smallest number that satisfy the description.
 

Sample Input
2 9 1 9 2
 

Sample Output
Case #1: 1 Case #2: 3
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.015600(s) query 1, Server time : 2024-05-11 16:59:32, Gzip enabled